代理平衡器和Apache Virtual Host多个域

时间:2013-10-03 01:10:38

标签: apache .htaccess caching mod-rewrite proxy

我们有以下配置,一个apache HTTP服务器将AJP请求代理到另一个应用程序,如下面的代理平衡器配置。

我们遇到的问题是应用程序只能理解一个HOST http标头,即exampledomain.com,但我们需要将www.exampledomain.com重写为exampledomain.com,但仍会显示www.exampledomain.com地址。

我们在浏览器和命中Apache服务器之间也有HTTP代理,并且不希望缓存这些内容!

以下是我们的配置:

<Proxy balancer://ajp-cluster>
Order deny,allow
Allow from all
BalancerMember ajp://10.10.10.11:8009
</Proxy>

<VirtualHost *:80>
ServerName exampledomain.com
ServerAlias exampledomain.com *.exampledomain.com
   RewriteEngine on
   RewriteCond %{HTTP_HOST} ^www.exampledomain.com
   RewriteRule ^/(.*)$ http://exampledomain.com/$1 [L,R=301,E=nocache:1]
   ## Set the response header if the "nocache" environment variable is set
   ## in the RewriteRule above.
   Header always set Cache-Control "no-store, no-cache, must-revalidate" env=nocache
   ## Set Expires too ...
   Header always set Expires "Thu, 01 Jan 1970 00:00:00 GMT" env=nocache
   ProxyPass / balancer://ajp-cluster/
   ProxyPassReverse / balancer://ajp-cluster/
   </VirtualHost>

0 个答案:

没有答案