I am having a problem with the wrong HTTP Response Content-Type header when accessing the Axis2 web service hosted on Tomcat for Apache through the AJP / 1.3 connector.
I can access the web service without problems in the browser through its RESTful interface, and I can see the results, but somehow Apache changes the Content-Type response header sent by Tomcat from text/xml to text/plain , and this bothers me from using a web service through SOAP in NetBeans due to the Unsupported Content-Type: text/plain Supported ones are: [text/xml] exception.
Here is the relevant section of my Apache vhosts configuration:
<VirtualHost *:80> ServerAdmin me@myserver.example 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>
And the corresponding section of my 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" />
If I access WS directly in Tomcat using the default connector on port 8080, I get the correct Content-Type , but if I access it through Apache, then I get text/plain , so this is definitely a problem with the proxy .
How can I solve this problem?
EDIT: I got it to work using the Tomcat HTTP connector for proxies instead of AJP, but I would prefer to use mod_ajp if I find a working solution.
I just changed
ProxyPass ajp://localhost:8009/axis2/services ProxyPassReverse ajp://localhost:8009/axis2/services
lines to
ProxyPass http://localhost:8080/axis2/services ProxyPassReverse http://localhost:8080/axis2/services
content-type tomcat apache proxy axis2
tsbnunes
source share