禁用反向代理的authentication摘要

我已经在我的一个域上设置了auth设置,但我想禁用它作为反向代理

<VirtualHost *:80> ServerName example.org DocumentRoot /var/www/ <Directory /var/www/> BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On AuthType Digest AuthName "Internal" AuthDigestDomain http://example.org/ AuthDigestProvider file AuthUserFile /etc/apache2/example.digest Require valid-user Options FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ExpiresActive On ExpiresDefault "access plus 7 days" ProxyRequests Off ProxyPreserveHost On ProxyPass /api/ http://api.otherdomain.com/ retry=0 nocanon ProxyPassReverse /api/ http://api.otherdomain.com/ AllowEncodedSlashes On <Proxy *> Order allow,deny Satisfy Any Allow from all </Proxy> 

正如你所看到的,我没有成功地尝试使用<Proxy>块来满足Any。

我认为,通过将您的反向代理configuration放在<Location>标记中,并利用Apache内部如何合并指令和集合的优先级 ,以相当普遍的方式解决您的问题。

最后应用<Location>指令,并应该否决<Directory>指令。

 <VirtualHost *:80> ServerName example.org DocumentRoot /var/www/ <Directory /var/www/> BrowserMatch "MSIE" AuthDigestEnableQueryStringHack=On AuthType Digest AuthName "Internal" AuthDigestDomain http://example.org/ AuthDigestProvider file AuthUserFile /etc/apache2/example.digest Require valid-user Options FollowSymLinks MultiViews AllowOverride All </Directory> ExpiresActive On ExpiresDefault "access plus 7 days" <Location /api/> Order allow,deny Allow from all ProxyPreserveHost On ProxyPass http://api.otherdomain.com/ retry=0 nocanon ProxyPassReverse http://api.otherdomain.com/ AllowEncodedSlashes On </Location> </VirtalHost> 

从Apache 2.3可以使用授权容器来expression更复杂的授权逻辑。