我有 Apache 2.4 转发 *:80 流量到我唯一的 Tomcat 7.0 网络应用程序 (Guacamole),如下所示:
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://localhost:8080/guacamole/
ProxyPassReverse / http:/localhost:8080/guacamole/
ProxyPassReverseCookiePath / http://localhost:8080/guacamole
这有效,除了当我注销 webapp 时,我收到 Tomcat 报告的以下 404:
HTTP Status 404 - /guacamole/guacamole/index.xhtml
根据我的阅读,我有几种选择,包括使用 ProxyPass/redirect、重写、VirtualHost 和符号链接(symbolic link)。其中一些选项在 Apache 和 Tomcat 配置下都是可能的。我很困惑。确保 /guacamole/guacamole/index.xhtml
(或 *)请求到达 /guacamole/index.xhtml
的最佳方法是什么?
(如果真正的根本原因在 Guacamole webapp 代码中,我不知道 Java。)
最佳答案
对于偶然发现此问题的任何人,我能够从 Suresh Atta 的回答中解决 to this question .
基本上我所要做的就是在/var/lib/tomcat/webapps/guacamole/logout.html 中创建一个自定义 404 html,其中包含礼貌的消息和再次登录的邀请:
<html>
<h2 align=center>Thank you. You're now logged out.</h2>
<h2 align=center>If this was a mistake or you'd like to begin a new session,
please <a href="http://guacamoleapp.address.com">click here.</a></h2>
</html>
然后我将这个指令添加到 web.xml 中:
<error-page>
<error-code>404</error-code>
<location>/logout.html</location>
</error-page>
我敢肯定有一种更简洁的方法可以做到这一点,但目前对此的要求很低,并且这消除了粗糙的边缘。
关于apache - 使用 Apache 作为前端重定向 Tomcat 404 URL 的最佳方法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39360381/