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
gefragt vor 3 Jahren514 Aufrufe
1 Antwort
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
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen