LoginSignup
1
2

More than 5 years have passed since last update.

リバースプロシキ上でのbasic認証にハマったこと

Posted at

リバースプロシキでURLの転送をしている場合、basic認証がうまくかからないので
その解決方法を書いていきます。

<VirtualHost *:80>
   ServerName example.com
   DocumentRoot "/var/www/html"
   ProxyPass / http://localhost:8800/
   ProxyPassReverse / http://localhost:8800/
   <Directory "/var/www/html">
     Allow from all
     AuthType Basic
     AuthUserFile "/var/www/html/.htpasswd"
     AuthName "MY_HP"
     Require valid-user
   </Directory>
</VirtualHost>

いつものように設定してもかかりませんでした。

いろいろ調べたところリバースプロシキとbasic認証の併用時に注意しなければいけないと
以下のURLに書かれていました。
http://enjoy1.bb-east.ne.jp/~grassland/edcb/80_info_1.html

変更後

<VirtualHost *:80>
   ServerName example.com
   DocumentRoot "/var/www/html"
   ProxyPass / http://localhost:8800/
   ProxyPassReverse / http://localhost:8800/
  <Location "/">
     Allow from all
     AuthType Basic
     AuthUserFile "/var/www/html/.htpasswd"
     AuthName "MY_HP"
     Require valid-user
   </Location>
</VirtualHost>

無事解決しました

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2