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년 전514회 조회
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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠