Amazon Cloudfront and .htaccess

I am testing Amazon Cloudfront in our development environment, which is protected by .htaccess / .htpasswd. Password protection on the dev server causes all cloudfront.net assets to be password protected as well. And the username and password combination doesn't work.

What I need to do is let the cloud host access the dev server by tearing some security holes in .htaccess.

I can get a list of IP addresses here , but since they can be changed, I was wondering if anyone knew of a better way.

Sorry, I cannot remove password protection.

+4
source share
1 answer

:

SetEnvIf User-Agent ^Amazon Cloudfront$ cdn
SetEnvIf Host ^static.dev.website.com$ cdn # This could also be a cloudfront.net host

AuthType Basic
AuthName "Dev Site"
AuthUserFile /directory/location/.htpasswd
Require valid-user

Order Deny,Allow
Deny from all
Allow from env=cdn
Satisfy Any

, , CloudFront, , Allow from env=cdn.

+3

All Articles