Apache httpd的mod_proxy_hcheck模块支持在URL级别上进行HTTP基本身份验证。这意味着可以为运行在代理服务器后的后端服务器指定不同的身份验证凭据。这是使用authn_core和auth_basic模块实现的。下面是一个示例配置:
ProxyPass ! "http://backend.example.com/"
ProxyPassReverse ! "http://backend.example.com/"
# URL based HTTP basic authentication
AuthType Basic
AuthName "Private Area"
AuthUserFile /path/to/user/file
Require valid-user
# Use mod_proxy_hcheck to check backend health
h1Check http://%{SERVER_NAME}/backend/
在这个例子中,“/backend/private/”目录需要HTTP基本身份验证,其他URL则不需要。运行在代理服务器上的Apache httpd使用mod_proxy_hcheck在每个请求之前测试后端服务器的健康状况。