I am getting an issue with the wrong HTTP Response
Content-Type header while being able to access an Axis2 web service located in Tomcat behind Apache with an AJP/1.3 connector.
I'm able to access the net service without problems within the browser through its Peaceful interface and I can tell the outcomes but in some way Apache is altering the response
Content-Type header sent by Tomcat from
text/plain also it prevents me from consuming the net service through Cleaning soap in NetBeans, due to an
Unsupported Content-Type: text/plain Supported ones are: [text/xml] exception.
Here's the appropriate portion of my Apache vhosts configuration:
<VirtualHost *:80> ServerAdmin email@example.com 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 also the relevant portion 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" />
Basically access the WS directly in Tomcat while using default connector on port 8080 I recieve the right
content-type but when I can get on through Apache i quickly get
text/plain, therefore it is certainly an issue with the proxy.
How do i solve this issue?
EDIT: I first got it to operate using the Tomcat HTTP connector for that proxying, rather than the AJP one, however i would rather use mod_ajp basically look for a working solution.
I simply transformed the
ProxyPass ajp://localhost:8009/axis2/services ProxyPassReverse ajp://localhost:8009/axis2/services
ProxyPass http://localhost:8080/axis2/services ProxyPassReverse http://localhost:8080/axis2/services
# DefaultType: the default MIME type the server will use for a document # if it cannot otherwise determine one, such as from filename extensions. # If your server contains mostly text or HTML documents, "text/plain" is # a good value. If most of your content is binary, such as applications # or images, you may want to use "application/octet-stream" instead to # keep browsers from trying to display binary files as though they are # text. # DefaultType None
This is actually the solution. See this part within the httpd.conf, It is important that DefalutType is None. If you notice plain/text this is actually the problem. Sorry, this option would be not mine however i dont discover by which blog i have thought it was :-)
I have spent yesteryear 2 days at the office searching for something such as this.
There has been a couple of bugs creating problems such as this previously, both in Apache HTTPD and Tomcat, but many appear to possess been resolved a minimum of 24 months ago. I believe that one is exactly what anybody using current software will probably be striking - that is certainly things i am presently going through:
There might be an area in Tomcat 7.x, but nobody has examined it yet. I expect to do then when I've amount of time in in regards to a week in addition to create a reliable test situation which means this could possibly get fixed in most relevant versions of tomcat.
This only happens when utilizing APR, so one intermediate option would be to prevent that (but that may have performance effects).