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
已提問 3 年前檢視次數 513 次
1 個回答
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
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南