简体   繁体   中英

Apache reverse proxy converting json to html

I will be amazed if anyone can answer this as I have found a few questions with no conclusive answers for the same but its worth a try.

I have an IBM IHS server fronting a websphere commerce 6 environment. In front of this on a separate server I have an Apache instance which is reverse proxying the requests to the Websphere box.

The reason for this is to manage certs etc..

Anyway the problem is that response from IHS in JSON are being converted by Apache to HTML. Subsequently the code cannot parse the data.

The 443 virtual host proxy is as per the below:

ProxyHTMLStripComments off
ProxyHTMLFixups reset
ProxyHTMLEnable on
ProxyRequests off
SetOutputFilter INFLATE;proxy-html;DEFLATE
ProxyHTMLDoctype XHTML
SSLEngine on
SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
ProxyRequests off
ProxyPreserveHost On
<proxy *>
    Order deny,allow
    Allow from all
</proxy>
SSLProxyEngine on
SSLProxyVerify none 
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

ProxyPass / https://xx.xx.xx.xx/ retry=1 acquire=3000 timeout=600 Keepalive=On
ProxyPassReverse / https://xx.xx.xx.xx/
ProxyPassReverseCookiePath / https://xx.xx.xx.xx/

This works absolutely fine however for responses from the websphere server coming back as JSON they are being surrounded by HTML tags - html, body and p. I need to stop this - any ideas!? Will be forever in your debt!

just in case anyone else has this after messing about with several options for several days, my latest combination seems to have worked.

Disabling the "ProxyRequests off" directive seems to resolve it.

Time for a beer! Thanks for people who offered tips!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM