Reputation: 5983
How to restrict access to origin for Amazon CloudFront only?
Upvotes: 3
Views: 2598
Reputation: 178956
Create a Custom Origin Header with a secret value, and add it to the origin configuration in CloudFront.
Modify your origin server configuration to throw an error if a request comes in without this secret value.
This is one of the reasons CloudFront supports custom origin headers.
If you configure your custom origin to respond to requests only if they include a custom header, you can prevent users from bypassing CloudFront and submitting requests directly to your origin.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/forward-custom-headers.html
Upvotes: 5