用RewriteRule替换ProxyPass

时间:2018-08-18 14:09:25

标签: apache mod-rewrite mod-proxy

我遇到了Apache中的一个已知错误,如果您在ProxyPass指令中使用非常长的主机名,则会导致错误。建议的解决方法是用RewriteRule替换ProxyPass。我很难让RewriteRule正常工作。这是我的ProxyPass的样子:

ProxyPass /_plugin/kibana https://long-aws-hostname/_plugin/kibana   timeout=300
ProxyPassReverse /_plugin/kibana https://long-aws-hostname/_plugin/kibana   timeout=300

您如何使用RewriteRule重写它?

谢谢, 史蒂夫

1 个答案:

答案 0 :(得分:0)

<Proxy balancer://ServiceCoreCluster>
    BalancerMember http://localhost:7080
    # Add more BalanceMember if Service is present in different host
    # BalancerMember http://<hostname>:<port>
</Proxy>
.
.
.

RewriteEngine on

RewriteRule "^/_plugin/kibana$" "balancer://ArgusCoreCluster/https://long-aws-hostname/_plugin/kibana" [P,L]

添加以上行,如果您已经配置了均衡器,则只需添加最后两行(替换您的行)。