如何设置 apache 2.2 的基本身份验证以绕过 IP?我已经关注了这个 wiki http://wiki.apache.org/httpd/BypassAuthenticationOrAuthorizationRequirements,但总是询问密码,也列出了 IP:
<Directory /var/www/html/mydir>
AuthName "Private"
AuthType Basic
AuthUserFile "/etc/httpd/htpasswd"
Require valid-user
Order allow,deny
Allow from 111.111.111.111 222.222.222.222
Satisfy any
</Directory>
我在haproxy下,但我设置了IP转发,我已经这样设置LogFormat
了:
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
access_log 是:
111.111.111.111 - - [25/Oct/2016:12:35:41 +0200] "GET /index.html HTTP/1.1" 401 487 "-" "Mozilla/5.0 (X11; Linux armv7l; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.7.0"