Amazon Cloudfront and .htaccess/.htpasswd

0

Hi!

I'm testing Amazon Cloudfront on a dev environment which is protected by .htaccess/.htpasswd. The password protection on the dev server is causing all of the cloudfront.net assets to be password protected as well. And no username/password combination works (the poppin just keep asking for password again and again). I cannot remove the password protection.

My .htaccess file:
ErrorDocument 401 default
AuthName "ACCESS"
AuthUserFile /var/www/html/folder/.htpasswd
AuthType Basic
AuthGroupFile None

<RequireAny> Require valid-user </RequireAny>

<Files "healthcheckfile.html">
Allow from all
Satisfy any
</Files>

To summarize I need to have a password protection on the website with .htaccess but the console prompt keep asking me for the password.
On local everything works well that's why I think the problem come from Cloudfront but maybe I'm wrong and the problem is from the ELB.

Do you have any ideas ?

ELO33
asked 3 years ago489 views
1 Answer
0

Ok I've found a solution.

Go to your Cloudfront behaviors and add the next ones where the webauth hit: Accept-Language Accept-Encoding Authorization

Solution thanks to https://medium.com/@omkar.sonawane/amazon-cloudfront-http-request-headers-authorization-header-22393c624da9

Edited by: ELO33 on Jan 5, 2021 9:06 AM

ELO33
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions