3

Apache 2.4 includes mod_proxy_html and that's great, it's catching all kinds of URLs inside the HTML coming back from the server and fixing them. But I've got a Seam app that sends back text/xml files to the client sometimes with fully qualified URLs that also need to be rewritten and mod_proxy_html doesn't fix them.

Apparently there was a mod_proxy_xml that used to exist separately from mod_proxy_html but Apache didn't include that. Is there a way to get mod_proxy_html configured to do the same thing? I need it to fix URLs in both the HTML and XML files coming back from a server.

Follow up:

I continue to fight with this and I've tried a few different solutions with no success including using mod_substitute (which somehow I'm configuring incorrectly because it never seems to substitute anything for anything) and using the force flag mod_proxy_html has to try and force it to do all files under a certain path.

John Munsch
  • 19,530
  • 8
  • 42
  • 72
  • Is building mod_proxy_xml not an option? – Jon Lin Aug 21 '12 at 20:45
  • @JonLin Not completely out of the question but that's going to be a last choice for me. I don't have any of the needed tools and the Apache we use comes from a site that builds the rest with Microsoft Visual C++. – John Munsch Aug 22 '12 at 02:49
  • 2
    How about using [mod_sed](http://httpd.apache.org/docs/2.4/mod/mod_sed.html)? It might be a little uglier than using proxy_html. – Jon Lin Aug 22 '12 at 02:52

1 Answers1

3

This is an old question, but I just faced the same issue. I tried with mod_proxy_html, compiled mod_proxy_xml, nothing worked.

@JonLin's suggestion is spot on, it works with mod_sed. The only if is mod_sed is documented to work inside Directory nodes. If you declare a Location though and do a SetOutputFilter instead of AddOutputFilter (which requires a mime type) it works beautifully.

The config that works is:

<Location "/">
    SetOutputFilter Sed
    OutputSed "s,http://internal:80,https://external.com,g"
</Location>
Murilo Yoshida
  • 161
  • 1
  • 8