用 Apache 做反向代理配置,配置文件如下:
ProxyPass /webapp/ balancer://webapp-proxy/
ProxyPassReverse /webapp/ balancer://webapp-proxy/
<Proxy balancer://webapp-proxy>
BalancerMember http://10.61.16.28:8523/webapp/
</Proxy>
ProxyPassMatch ^(/qa(/\w+)+) balancer://qa-proxy/
ProxyPassReverse ^(/qa(/\w+)+) balancer://qa-proxy/
<Proxy balancer://qa-proxy>
BalancerMember http://10.61.16.27:8522/
</Proxy>
ProxyPassMatch ^(/qa-client(/\w+)*.*) balancer://qa-client-proxy/
ProxyPassReverse ^(/qa-client(/\w+)*.*) balancer://qa-client-proxy/
<Proxy balancer://qa-client-proxy>
BalancerMember http://10.61.16.28:8524/
</Proxy>
ProxyPassMatch ^(/wx(/\w+)*.*) balancer://qa-wx-proxy/
ProxyPassReverse ^(/wx(/\w+)*.*) balancer://qa-wx-proxy/
<Proxy balancer://qa-wx-proxy>
BalancerMember http://10.61.16.28:8525/
</Proxy>
为什么 ip 访问时正常,用域名访问时就会提示重定向次数过多。对了,Apache 配置文件里还有 webgate 单点登录拦截。