Text of httpd.apache.org › docs › current › mod › mod_proxy_html.html as Styx crawled it on Nov 18, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

mod_proxy_html - Apache HTTP Server Version 2.4

Modules | Directives | FAQ | Glossary | Sitemap | Report a bug Apache HTTP Server Version 2.4 Apache > HTTP Server > Documentation > Version 2.4 > Modules Apache Module mod_proxy_html Available Languages: en | fr Description: Rewrite HTML links in to ensure they are addressable from Clients' networks in a proxy context. Status: Base Module Identifier: proxy_html_module Source File: mod_proxy_html.c Compatibility: Version 2.4 and later Summary This module provides an output filter to rewrite HTML 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. For example, if a company has an application server at appserver.example.com that is only visible from within the company's internal network, and a public webserver www.example.com , they may wish to provide a gateway to the application server at http://www.example.com/appserver/ .

When the application server links to itself, those links need to be rewritten to work through the gateway. mod_proxy_html serves to rewrite <a href="http://appserver.example.com/foo/bar.html">foobar</a> to <a href="http://www.example.com/appserver/foo/bar.html">foobar</a> making it accessible from outside. mod_proxy_html was originally developed at WebÞing, whose extensive documentation may be useful to users. Directives ProxyHTMLBufSize ProxyHTMLCharsetOut ProxyHTMLDocType ProxyHTMLEnable ProxyHTMLEvents ProxyHTMLExtended ProxyHTMLFixups ProxyHTMLInterp ProxyHTMLLinks ProxyHTMLMeta ProxyHTMLStripComments ProxyHTMLURLMap Bugfix checklist httpd changelog Known issues Report a bug ProxyHTMLBufSize Directive ¶ Description: Sets the buffer size increment for buffering inline scripts and stylesheets.

Syntax: ProxyHTMLBufSize bytes Default: ProxyHTMLBufSize 8192 Context: server config, virtual host, directory Status: Base Module: mod_proxy_html Compatibility: Version 2.4 and later; available as a third-party for earlier 2.x versions In order to parse non-HTML content (stylesheets and scripts) embedded in HTML documents, mod_proxy_html has to read the entire script or stylesheet into a buffer. This buffer will be expanded as necessary to hold the largest script or stylesheet in a page, in increments of bytes as set by this directive.

The default is 8192, and will work well for almost all pages. However, if you know you're proxying pages containing stylesheets and/or scripts bigger than 8K (that is, for a single script or stylesheet, NOT in total), it will be more efficient to set a larger buffer size and avoid the need to resize the buffer dynamically during a request. ProxyHTMLCharsetOut Directive ¶ Description: Specify a charset for mod_proxy_html output.

Syntax: ProxyHTMLCharsetOut Charset | * Default: ProxyHTMLCharsetOut UTF-8 Context: server config, virtual host, directory Status: Base Module: mod_proxy_html Compatibility: Version 2.4 and later; available as a third-party for earlier 2.x versions This selects an encoding for mod_proxy_html output. It should not normally be used, as any change from the default UTF-8 (Unicode - as used internally by libxml2) will impose an additional processing overhead.

The special token ProxyHTMLCharsetOut * will generate output using the same encoding as the input. Note that this relies on mod_xml2enc being loaded. ProxyHTMLDocType Directive ¶ Description: Sets an HTML or XHTML document type declaration. Syntax: ProxyHTMLDocType HTML|XHTML [Legacy] OR ProxyHTMLDocType fpi [SGML|XML] Context: server config, virtual host, directory Status: Base Module: mod_proxy_html Compatibility: Version 2.4 and later; available as a third-party for earlier 2.x versions In the first form, documents will be declared as HTML 4.01 or XHTML 1.0 according to the option selected.

This option also determines whether HTML or XHTML syntax is used for output. Note that the format of the documents coming from the backend server is immaterial: the parser will deal with it automatically. If the optional second argument is set to Legacy , documents will be declared "Transitional", an option that may be necessary if you are proxying pre-1998 content or working with defective authoring/publishing tools.

In the second form, it will insert your own FPI. The optional second argument determines whether SGML/HTML or XML/XHTML syntax will be used. The default is changed to omitting any FPI, on the grounds that no FPI is better than a bogus one. If your backend generates decent HTML or XHTML, set it accordingly. If the first form is used, mod_proxy_html will also clean up the HTML to the specified standard. It cannot fix every error, but it will strip out bogus elements and attributes.

It will also optionally log other errors at LogLevel Debug. ProxyHTMLEnable Directive ¶ Description: Turns the proxy_html filter on or off. Syntax: ProxyHTMLEnable On|Off Default: ProxyHTMLEnable Off Context: server config, virtual host, directory Status: Base Module: mod_proxy_html Compatibility: Version 2.4 and later; available as a third-party module for earlier 2.x versions. A simple switch to enable or disable the proxy_html filter.

If mod_xml2enc is loaded it will also automatically set up internationalisation support. Note that the proxy_html filter will only act on HTML data (Content-Type text/html or application/xhtml+xml) and when the data are proxied. You can override this (at your own risk) by setting the PROXY_HTML_FORCE environment variable. ProxyHTMLEvents Directive ¶ Description: Specify attributes to treat as scripting events. Syntax: ProxyHTMLEvents attribute [attribute ...] Context: server config, virtual host, directory Status: Base Module: mod_proxy_html Compatibility: Version 2.4 and later; available as a third-party for earlier 2.x versions Specifies one or more attributes to treat as scripting events and apply ProxyHTMLURLMap s to where enabled.

You can specify any number of attributes in one or more ProxyHTMLEvents directives. Requires ProxyHTMLExtended Scripting events are only processed when ProxyHTMLExtended is set to On . Without it, event attributes are passed through unmodified even if listed in ProxyHTMLEvents . Normally you'll set this globally. If you set ProxyHTMLEvents in more than one scope so that one overrides the other, you'll need to specify a complete set in each of those scopes.

A default configuration is supplied in proxy-html.conf and defines the events in standard HTML 4 and XHTML 1. ProxyHTMLExtended Directive ¶ Description: Determines whether to fix links in inline scripts, stylesheets, and scripting events. Syntax: ProxyHTMLExtended On|Off Default: ProxyHTMLExtended Off Context: server config, virtual host, directory Status: Base Module: mod_proxy_html Compatibility: Version 2.4 and later; available as a third-party for earlier 2.x versions Set to Off , HTML links are rewritten according to the ProxyHTMLURLMap directives, but links appearing in Javascript and CSS are ignored.

Set to On , all scripting events (as determined by ProxyHTMLEvents ) and embedded scripts or stylesheets are also processed by the ProxyHTMLURLMap rules, according to the flags set for each rule. Since this requires more parsing, performance will be best if you only enable it when strictly necessary. You'll also need to take care over patterns matched, since the parser has no knowledge of what is a URL within an embedded script or stylesheet.

In particular, extended matching of / is likely to lead to false matches. ProxyHTMLFixups Directive ¶ Description: Fixes for simple HTML errors. Syntax: ProxyHTMLFixups [lowercase] [dospath] [reset] Default: ProxyHTMLFixups none Context: server config, virtual host, directory Status: Base Module: mod_proxy_html Compatibility: Version 2.4 and later; available as a third-party for earlier 2.x versions This directive takes one to three arguments as follows: lowercase Urls are rewritten to lowercase dospath Backslashes in URL

The rest of this page is on the live site.