Jason
Jason

Reputation: 23395

How to use Cloudfront with basic auth?

I am implementing a cloudfront solution and would like to test / run it on my staging server, however staging is "protected" from the outside world by basic_auth.

I have tried entering a URL with the basic_auth username / password in it e.g user:[email protected] but CloudFront rejects this URL.

How can I allow Cloudfront / an origin to access my staging server?

(I am hosting on heroku, using rails 4)

Upvotes: 8

Views: 7389

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179094

Because of the way web content caching works, most HTTP request headers are not forwarded from CloudFront to the origin server by default, including the Authorization header needed for basic auth.

You'll need to whitelist the Authorization header in the appropriate cache behavior(s).

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/distribution-web-values-specify.html#DownloadDistValuesWhitelistHeaders

Upvotes: 14

Related Questions