【问题标题】:double proxy statements for apacheapache 的双重代理声明
【发布时间】:2013-12-10 17:39:02
【问题描述】:

如您所见,我试图让 / 和 /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

自从提交新网址后, 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>

【问题讨论】:

    标签: apache tomcat proxy


    【解决方案1】:

    解决方案可能是使用 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 快捷方式添加一些重定向(RewriteRule with [R=301] 选项)。

    【讨论】:

      猜你喜欢
      • 2021-09-22
      • 1970-01-01
      • 1970-01-01
      • 2013-11-30
      • 2011-01-10
      • 1970-01-01
      • 2017-05-03
      • 2013-02-17
      • 2020-01-01
      相关资源
      最近更新 更多