I'm using Apache proxy to access a web application on a VM.

The proxy configuration works great, no issues.

However, a side effect I see is that the Apache proxy "fixes" HTML that is being proxied.

This isn't a problem for my own material, but it causes awful rendering a third party frame work I'm using, PatternFly.

A simple example of a typical change in the HTML is:

<             <td style="vertical-align:middle" rowspan=1><a href="/timesheet/project/9">HWSUPP</td>
<             <td style="vertical-align:middle" rowspan=1><a href="Chris, Welch: chris.welch">Chris Welch</td>
>             <td style="vertical-align:middle" rowspan="1"><a href="/timesheet/project/9">HWSUPP</a></td>
>             <td style="vertical-align:middle" rowspan="1"><a href="Chris, Welch: chris.welch">Chris Welch</a></td>

The "<" HTML is the proxied source, the ">" is the original.

As you can see, the unnecessary quotes around the rowspan and the terminating tag are removed by the Apache Proxy.

For the most part, these fix ups are helpful, but they are causing rendering problems when I use PatternFly that make the site unusable.

I know, the immediate answer is going to be "fix the bad source", but this isn't practical with thousands of third party source lines and Django templates are generating their own source as well.

Is there anyway to turn off this behaviour with Apache proxy?

The proxy configuration I'm using is (Apache 2.2.15):

ProxyRequests off

ProxyHTMLLogVerbose On
LogLevel Debug

ProxyPass /testcrm/ http://django/
ProxyHTMLURLMap http://django /testcrm

<Location /testcrm/>
        ProxyPassReverse /
        SetOutputFilter  proxy-html
        ProxyHTMLURLMap  /      /testcrm/
        RequestHeader    unset  Accept-Encoding

Thanks in advance!

  • I tried this with an Apache 2.4 server and I get the same behaviour. – Chris Welch Jul 12 at 17:39
  • I've moved this to webmasters.stackexchange as it is more appropriate there. – Chris Welch Jul 12 at 18:02
  • Should anyone stumble on this with the same problem...: Although I wasn't able to find a way to turn off the modifications, I found that most of the rendering issues were due to the proxy server removing the doctype. I added: ProxyHTMLDocType '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""w3.org/TR/html4/strict.dtd">' to the configuration and I now get the same rendering as the non proxy view. – Chris Welch 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.