我在与一个不正确的HTTP响应Content-Type
头一个问题,同时通过访问在Tomcat中托管后面的Apache Axis2 Web服务,通过AJP连接器发送到Apache Tomcat的HTTP响应的Content-Type头一个AJP/1.3连接器。如何保存使用mod_proxy
我可以通过它的RESTful接口没有问题访问Web服务在浏览器中,我可以看到的结果,但不知何故Apache是改变从text/xml
被Tomcat发送的响应Content-Type
头text/plain
,它使我从使用Web服务通过NetBeans中的SOAP,因为Unsupported Content-Type: text/plain Supported ones are: [text/xml]
异常。
这里是我的Apache虚拟主机配置的相关章节:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName myserver.example
ServerAlias other.myserver.example
ProxyPreserveHost On
SetEnv force-proxy-request-1.0 1
SetEnv proxy-nokeepalive 1
<Location /axis2/services>
ProxyPass ajp://localhost:8009/axis2/services
ProxyPassReverse ajp://localhost:8009/axis2/services
</Location>
</VirtualHost>
我的Tomcat的server.xml中的相关章节:
<Connector port="8009" protocol="AJP/1.3" redirectPort="9443" />
<Connector port="9443" protocol="HTTP/1.1" SSLEnabled="true" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
SSLCertificateFile="path/to/bundle"
SSLCertificateKeyFile="path/to/key"
SSLPassword="S3cr3t"
proxyName="myserver.example" proxyPort="443" />
如果我使用默认的直接访问WS在Tomcat中8080端口连接器,我得到了正确的content-type
但如果我通过Apache访问它,然后我得到text/plain
,所以它肯定与代理问题。
我该如何解决这个问题?
编辑:我通过使用代理的Tomcat HTTP连接器,而不是AJP之一,但我更喜欢使用mod_ajp,如果我找到一个工作的解决方案。
我只是改变了
ProxyPass ajp://localhost:8009/axis2/services
ProxyPassReverse ajp://localhost:8009/axis2/services
线
ProxyPass http://localhost:8080/axis2/services
ProxyPassReverse http://localhost:8080/axis2/services
http://markmail.org/message/btwcnbl2i7ftwj4n#query:apache%20ajp%20changes%20Content -type%2Bpage + page:1 + mid:btwcnbl2i7ftwj4n + state:结果似乎与您的问题相关 – JoseK 2010-08-04 06:32:58
是的,这是同样的问题,我已经发现了一些类似于2007年的邮件存档之前发布的问题在这里,但我仍然可以找不到解决这个问题的办法。 – tsbnunes 2010-08-04 13:50:51