如何将apache配置为反向代理以接受不带末尾/的请求

时间:2019-05-30 10:44:04

标签: apache2 reverse-proxy

我将以下apache2配置用作反向代理:

<Proxy balancer://mycluster>
BalancerMember http://10.93.43.250:80                        
</Proxy>

<Proxy balancer://api>
BalancerMember http://10.93.43.251:80

ProxyPreserveHost On
ProxyPass "/gitea/" "balancer://mycluster/"
ProxyPassReverse "/gitea/" "balancer://mycluster/"

ProxyPass "/api/" "balancer://api/api/"
ProxyPassReverse "/api/" "balancer://api/api/"

ProxyPass "/swagger/" "balancer://api/swagger/"
ProxyPassReverse "/swagger/" "balancer://api/swagger/"

此配置有什么问题,因为如果我浏览http://example.com/swagger会得到

Not Found The requested URL /swagger was not found on this server.

http://example.com/giteahttp://example.com/api相同

仅当我在网址中添加最后一个/时才有效:http://example.com/swagger/

0 个答案:

没有答案