apache - apache 的双重代理语句

标签 apache tomcat proxy

如您所见,我试图让/和/BowlingFacelets/faces/指向同一个地方。

问题是当我提交表单时,JSF 页面将添加/BowlingFacelets/faces/。但是,我不希望最终用户必须输入这么长的语句才能启动应用程序。有办法做到这一点吗?

请注意,如果我手动添加,这将起作用

score.megahooked.com/BowlingFacelets/faces to the URL
ProxyPass / http://megahooked.com:8080/
ProxyPassReverse / http://megahooked.com:8080/

这将无法正常工作

score.megahooked.com/createEvent.xhtml

自从提交新 URL 时 找不到 score.megahooked.com/BowlingFacelets/faces/updateEvent.xhtml。


<VirtualHost *:80>
    ServerName score.megahooked.com
    ProxyRequests Off
    ProxyPreserveHost On
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
    ProxyPass / http://megahooked.com:8080/BowlingFacelets/faces/
    ProxyPassReverse / http://megahooked.com:8080/BowlingFacelets/faces/
    ProxyPass /BowlingFacelets/faces/ http://megahooked.com:8080/BowlingFacelets/faces/
    ProxyPassReverse /BowlingFacelets/faces/ http://megahooked.com:8080/BowlingFacelets/faces/

</VirtualHost>

最佳答案

解决方案可能是使用 mod_proxy_html。它可以解析 HTML 文档并在其中重写 URL。例如,我将应用程序“restfrontend”(映射到“/restfrontend”)作为根应用程序访问(映射到“/”)

ProxyHTMLEnable On
ProxyHTMLExtended On
ProxyHTMLMeta On
ProxyHTMLLogVerbose On
ProxyHTMLURLMap ^/restfrontend()$ $1 [LR]
ProxyHTMLURLMap /restfrontend/ /

ProxyPassReverseCookiePath /restfrontend /
ProxyHTMLDoctype HTML

我强烈反对这样做。这个模块很难配置。同时配置两条可能的路径将是一场噩梦。

更好的解决方案是将应用程序作为 ROOT 直接部署在 Tomcat 中,并为其他 URL 快捷方式添加一些重定向(使用 [R=301] 选项的 RewriteRule)。

关于apache - apache 的双重代理语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20501457/

相关文章:

apache - 在 Openshift 上使用 JBoss cartridge 配置 Apache HTTP 服务器

node.js - 如何将 https 代理与 node.js https/request 客户端一起使用?

java - 尝试创建代理对象时出现 ClassCastException

java - 在 Windows XP 中为 Tomcat 服务设置默认语言环境

sql-server - 开源数据库代理?

python - 当我尝试运行 Flask 应用程序时,为什么 apache 不加载我的 .so 库?

php - 无法使用 PHP 5.6.14 连接到 oracle 数据库 - OCI 连接问题

apache - 如何使用 HTTP 客户端传递客户端证书?

regex - Apache 重定向正则表达式 : match something that is not following something

java - Jersey JAX-RS 服务中的 BASIC 身份验证和 Tomcat 6.0 失败