目前我的 web 应用程序在 jboss 上运行,但我有一个 apache 服务器用作我的应用程序的代理。我可以在我的 jboss 服务器上上传 XML 文件。上传时,它返回 HTTP 200 和 XML 响应 Content-Type: text/xml
。
一些用户在重定向到 jboss 的 apache 实例上使用此功能。这些用户在上传文件和 Accept:/header 时有时会使用 Content-Type: application/xml。使用这个 header jboss 可以正常工作,但是 apache 总是返回错误的响应:
HTTP/1.1 502 Bad Gateway
< Date: Mon, 31 Jan 2011 23:33:47 GMT
< Server: Apache/2.0.63 (Unix) mod_jk/1.2.27
< Content-Length: 232
< Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Bad Gateway</title>
</head><body>
<h1>Bad Gateway</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
</p>
为什么当用户使用 application/xml 而不是 text/xml header 值时会发生? apache 是否以某种方式比较这些 header ?当用户使用 text/xml 值时,一切正常,apache 打印 jboss 200 OK 响应。
最佳答案
我猜你正在使用 apache2 。 编辑这个文件 /etc/apache2/modsenabled/mime.conf 加一行 AddType 应用程序/xml .xml
--kiran.kumar
关于java - Apache 服务器作为 Jboss 问题的代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4885112/