【问题标题】:Tomcat 6.0.29 and Apache2 Proxy pass rendering text/html as text/plainTomcat 6.0.29 和 Apache2 代理通过将 text/html 渲染为 text/plain
【发布时间】:2011-12-08 15:41:41
【问题描述】:

我们在 Ubuntu 上使用 apache2 后面的 tomcat 6.0.29。 jsp 页面被呈现为纯文本,而不是呈现为 html(我在浏览器窗口中看到整个 html),如果我直接通过 tomcat 实例点击实例,一切正常。

我正在使用 mod_proxy_ajp,我也尝试使用 mod_proxy_http。但没有运气。

使用开发工具检查 chrome 浏览器中的内容类型。如果我点击 web 服务器 (http://www.myserver.com),那么类型为“text/plain”,如果我点击 tomcat (http://www.myserver.com:8080),那么类型以 'text/html' 的形式出现,页面正确呈现。

这是我的 apache 配置:

ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>

ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/

有人遇到过这种问题吗?如果是,您能否分享一下这是如何解决的?

【问题讨论】:

    标签: java apache tomcat tomcat6 mod-proxy


    【解决方案1】:

    在 /etc/apache2/apache2.conf 中,查找名为“DefaultType”的配置项,默认为“text/plain”。将其更改为“text/html”,重新启动 Apache,应用程序运行正常。

    来源:http://www.j-dimension.com/?p=28

    【讨论】:

      猜你喜欢
      • 2011-12-10
      • 1970-01-01
      • 2017-03-05
      • 2014-02-14
      • 2011-05-25
      • 1970-01-01
      • 2021-08-04
      • 2012-05-19
      • 1970-01-01
      相关资源
      最近更新 更多