mod_proxy_xml is an output filter to rewrite links in a proxy situation, to ensure that links work for users outside the proxy. It serves the same purpose as Apache's ProxyPassReverse directive does for HTTP headers, and is an essential component of a reverse proxy.

mod_proxy_xml may be an alternative to mod_proxy_html for XHTML and XML pages. The differences are:

The final two differences mean that mod_proxy_xml is broadly equivalent to Version 1 of mod_proxy_html.

How to use it

Deployment is broadly similar to mod_proxy_html, and the Tutorial on Reverse Proxying is useful background. The details are simpler than mod_proxy_html, but rely on mod_xmlns or mod_publisher configuration, and you should use mod_filter to apply it to only to relevant markup.

Configuration Directive

ProxyXMLURLMap	from-pattern	to-pattern

This causes from-pattern to be rewritten to to-pattern whenever it appears in links. Matching is starts-with.

Other Configuration

mod_proxy_xml handlers have to be registered as namespace providers. To process links in XHTML and WML, use

XMLNSUseNamespace on proxy
XMLNSUseNamespace on proxy

with mod_xmlns, or

MLUseNamespace on proxy
MLUseNamespace on proxy

with mod_publisher.

If you are dealing with a default namespace that isn't declared in the markup, you will also need a default namespace. For example, to parse WML without the namespace attribute:

XMLNSUseNamespace on proxy

These can be used with SetOutputFilter xmlns. However, it is better controlled with mod_filter. So for example you can use it together with mod_proxy_html to filter different markup types. The following will filter text/html through mod_proxy_html, and (with the above XMLNSUseNamespace directives) will filter WML and XHTML through mod_proxy_xml:

FilterDeclare url-fix Content-Type
FilterProvider url-fix proxy-html $text/html
FilterProvider url-fix xmlns $text/vnd.wap.wml
FilterProvider url-fix xmlns $application/xhtml+xml
FilterChain url-fix
FilterProtocol url-fix "change=yes byteranges=no"


Please don't just email with support questions. If you need more help than is provided in the documentation, you may register for support. If you don't want to register, you may also ask questions in a public forum such as the apache users mailinglist, where your question and any responses will be on record for others to see.


mod_proxy_xml.c source code is available under the GNU General Public License (GPL). As with other opensource modules, we can consider alternative licenses by request.