在我的Apache 2配置中,我有一个VirtualHost
看起来像这样的东西:
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 # 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?
我正在使用虚拟主机作为网络上另一台服务器(我称之为端点)的反向代理.
我试图找出一种配置,允许网络内部的用户sub.domain.com
自动为端点提供服务.但是,应提示网络外的用户提供凭据
端点需要一个我使用RequestHeader(我想要的)隐藏的密码.外部用户的密码应该是不同的,需要是BasicAuth,从htpasswd
文件中获取用户列表.
# 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