Bo *_*nes 1 apache apache2 apache-config basic-authentication
在我的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>
Run Code Online (Sandbox Code Playgroud)
我正在使用虚拟主机作为网络上另一台服务器(我称之为端点)的反向代理.
我试图找出一种配置,允许网络内部的用户sub.domain.com自动为端点提供服务.但是,应提示网络外的用户提供凭据
端点需要一个我使用RequestHeader(我想要的)隐藏的密码.外部用户的密码应该是不同的,需要是BasicAuth,从htpasswd文件中获取用户列表.
<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
Run Code Online (Sandbox Code Playgroud)
右边是http://httpd.apache.org/docs/2.2/mod/core.html#satisfy:
Require valid-user
Order allow,deny
Allow from 192.168.1
Satisfy any
Run Code Online (Sandbox Code Playgroud)
当然,您还需要包含AuthUserFile或任何指令
AuthType basic
AuthName "yadayadayada"
AuthUserFile /foo/bar/blah/.htpasswd
</Location>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10952 次 |
| 最近记录: |