在我的 Apache 2 配置中,我有一个VirtualHost
看起来像这样:
<VirtualHost *:80>
ServerName sub.domain.com
# username:password sent on to endpoint
RequestHeader set Authorization "Basic dXNlcm5hbWU6cGFzc3dvcmQ=="
ProxyPass /xyz http://192.168.1.253:8080/endpoint
ProxyPassReverse /xyz http://192.168.1.253:8080/endpoint
<Location /xyz>
# This needs to let users through under the following circumstances
# * They are in 192.168.1.0/24
# * They have a valid user in a htpasswd file
# So what goes here?
</Location>
</VirtualHost>
我使用虚拟主机作为网络上另一台服务器(我将其称为端点)的反向代理。
我正在尝试找出一种配置,允许网络内的用户浏览sub.domain.com
自动为端点提供服务。但是,应提示网络外的用户输入凭据
端点需要一个密码,我使用 RequestHeader (我想要的)隐藏了该密码。提示外部用户的密码应该是不同的,并且需要是 BasicAuth,从htpasswd
file.
<Location /xyz>
# This needs to let users through under the following circumstances
# * They are in 192.168.1.0/24
# * They have a valid user in a htpasswd file
就在http://httpd.apache.org/docs/2.2/mod/core.html#satisfy:
Require valid-user
Order allow,deny
Allow from 192.168.1
Satisfy any
当然,您还需要包含您的 AuthUserFile 或任何指令
AuthType basic
AuthName "yadayadayada"
AuthUserFile /foo/bar/blah/.htpasswd
</Location>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)