将代理与子目录一起使用时出现错误资产路径



我在Play!前面使用Apache Proxy。为了重用我的SSL证书,Apache 配置是这样的:

    <Location /balancer-manager>
            SetHandler balancer-manager
            Order Deny,Allow
            Deny from all
    </Location>
    <Proxy balancer://mycluster>
    BalancerMember http://localhost:9997
    BalancerMember http://localhost:9998 status=+H
    </Proxy>
    <Proxy *>
            Order Allow,Deny
            Allow From All
    </Proxy>
    ProxyPreserveHost On
    ProxyPass /balancer-manager !
    ProxyPass /play/ balancer://mycluster/
    ProxyPassReverse /play http://localhost:9997/    
    ProxyPassReverse /play http://localhost:9998/  

起初似乎还可以,但我发现资产路径与预期不符。正确的道路应该像这样http://domain/play/jquery.js,但是玩!像这样返回http://domain/jquery.js,因此,Apache在用户获取资源时无法解析URL,有什么建议吗?

谢谢!

Play对你的Apache配置一无所知 - 它仍然认为它仍然在域的根文件夹中运行。您可以使用的最干净的方法是(恕我直言)使用子域http://play.domain.tld而不是嵌套文件夹http://domain.tld/play否则您需要在路由中反映 url 的play段。

相关内容

最新更新