1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5              This file is generated from xml source: DO NOT EDIT
6        XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7      -->
8<title>mod_proxy_html - Apache HTTP Server</title>
9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" />
12<script src="/style/scripts/prettify.min.js" type="text/javascript">
13</script>
14
15<link href="/images/favicon.ico" rel="shortcut icon" /></head>
16<body>
17<div id="page-header">
18<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
19<p class="apache">Apache HTTP Server Version 2.4</p>
20<img alt="" src="/images/feather.gif" /></div>
21<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
22<div id="path">
23<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="../">Version 2.4</a> &gt; <a href="./">Modules</a></div>
24<div id="page-content">
25<div id="preamble"><h1>Apache Module mod_proxy_html</h1>
26<div class="toplang">
27<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_html.html" title="English">&nbsp;en&nbsp;</a> |
28<a href="/fr/mod/mod_proxy_html.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
29</div>
30<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Rewrite HTML links in to ensure they are addressable
31from Clients' networks in a proxy context.</td></tr>
32<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
33<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>proxy_html_module</td></tr>
34<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_proxy_html.c</td></tr>
35<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later.  Available as a third-party module
36for earlier 2.x versions</td></tr></table>
37<h3>Summary</h3>
38
39<p>This module provides an output filter to rewrite HTML links in a
40proxy situation, to ensure that links work for users outside the proxy.
41It serves the same purpose as Apache's ProxyPassReverse directive does
42for HTTP headers, and is an essential component of a reverse proxy.</p>
43
44<p>For example, if a company has an application server at
45<code>appserver.example.com</code> that is only visible from within
46the company's internal network, and a public webserver
47<code>www.example.com</code>, they may wish to provide a gateway to the
48application server at <code>http://www.example.com/appserver/</code>.
49When the application server links to itself, those links need to be
50rewritten to work through the gateway. mod_proxy_html serves to rewrite
51<code>&lt;a href="http://appserver.example.com/foo/bar.html"&gt;foobar&lt;/a&gt;</code> to
52<code>&lt;a href="http://www.example.com/appserver/foo/bar.html"&gt;foobar&lt;/a&gt;</code>
53making it accessible from outside.</p>
54
55<p>mod_proxy_html was originally developed at Web�ing, whose
56extensive <a href="http://apache.webthing.com/mod_proxy_html/">documentation</a> may be useful to users.</p>
57</div>
58<div id="quickview"><h3 class="directives">Directives</h3>
59<ul id="toc">
60<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlbufsize">ProxyHTMLBufSize</a></li>
61<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlcharsetout">ProxyHTMLCharsetOut</a></li>
62<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmldoctype">ProxyHTMLDocType</a></li>
63<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlenable">ProxyHTMLEnable</a></li>
64<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlevents">ProxyHTMLEvents</a></li>
65<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlextended">ProxyHTMLExtended</a></li>
66<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlfixups">ProxyHTMLFixups</a></li>
67<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlinterp">ProxyHTMLInterp</a></li>
68<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmllinks">ProxyHTMLLinks</a></li>
69<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlmeta">ProxyHTMLMeta</a></li>
70<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlstripcomments">ProxyHTMLStripComments</a></li>
71<li><img alt="" src="/images/down.gif" /> <a href="#proxyhtmlurlmap">ProxyHTMLURLMap</a></li>
72</ul>
73<ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
74
75<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
76<div class="directive-section"><h2><a name="ProxyHTMLBufSize" id="ProxyHTMLBufSize">ProxyHTMLBufSize</a> <a name="proxyhtmlbufsize" id="proxyhtmlbufsize">Directive</a></h2>
77<table class="directive">
78<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets the buffer size increment for buffering inline scripts and
79stylesheets.</td></tr>
80<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLBufSize <var>bytes</var></code></td></tr>
81<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
82<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
83<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
84<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
85for earlier 2.x versions</td></tr>
86</table>
87<p>In order to parse non-HTML content (stylesheets and scripts) embedded
88in HTML documents, mod_proxy_html
89has to read the entire script or stylesheet into a buffer.  This buffer will
90be expanded as necessary to hold the largest script or stylesheet in a page,
91in increments of <var>bytes</var> as set by this directive.</p>
92<p>The default is 8192, and will work well for almost all pages.  However,
93if you know you're proxying pages containing stylesheets and/or
94scripts bigger than 8K (that is, for a single script or stylesheet,
95NOT in total), it will be more efficient to set a larger buffer
96size and avoid the need to resize the buffer dynamically during a request.
97</p>
98
99</div>
100<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
101<div class="directive-section"><h2><a name="ProxyHTMLCharsetOut" id="ProxyHTMLCharsetOut">ProxyHTMLCharsetOut</a> <a name="proxyhtmlcharsetout" id="proxyhtmlcharsetout">Directive</a></h2>
102<table class="directive">
103<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify a charset for mod_proxy_html output.</td></tr>
104<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLCharsetOut <var>Charset | *</var></code></td></tr>
105<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
106<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
107<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
108<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
109for earlier 2.x versions</td></tr>
110</table>
111<p>This selects an encoding for mod_proxy_html output.  It should not
112normally be used, as any change from the default <code>UTF-8</code>
113(Unicode - as used internally by libxml2) will impose an additional
114processing overhead.  The special token <code>ProxyHTMLCharsetOut *</code>
115will generate output using the same encoding as the input.</p>
116<p>Note that this relies on <code class="module"><a href="/mod/mod_xml2enc.html">mod_xml2enc</a></code> being loaded.</p>
117
118</div>
119<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
120<div class="directive-section"><h2><a name="ProxyHTMLDocType" id="ProxyHTMLDocType">ProxyHTMLDocType</a> <a name="proxyhtmldoctype" id="proxyhtmldoctype">Directive</a></h2>
121<table class="directive">
122<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Sets an HTML or XHTML document type declaration.</td></tr>
123<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLDocType <var>HTML|XHTML [Legacy]</var><br /><strong>OR</strong>
124<br />ProxyHTMLDocType <var>fpi [SGML|XML]</var></code></td></tr>
125<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
126<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
127<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
128<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
129for earlier 2.x versions</td></tr>
130</table>
131<p>In the first form, documents will be declared as HTML 4.01 or XHTML 1.0
132according to the option selected.  This option also determines whether
133HTML or XHTML syntax is used for output.   Note that the format of the
134documents coming from the backend server is immaterial: the parser will
135deal with it automatically.  If the optional second argument is set to
136"Legacy", documents will be declared "Transitional", an option that may
137be necessary if you are proxying pre-1998 content or working with defective
138authoring/publishing tools.</p>
139<p>In the second form, it will insert your own FPI.  The optional second
140argument determines whether SGML/HTML or XML/XHTML syntax will be used.</p>
141<p>The default is changed to omitting any FPI,
142on the grounds that no FPI is better than a bogus one.  If your backend
143generates decent HTML or XHTML, set it accordingly.</p>
144<p>If the first form is used, mod_proxy_html
145will also clean up the HTML to the specified standard.  It cannot
146fix every error, but it will strip out bogus elements and attributes.
147It will also optionally log other errors at <code class="directive"><a href="/mod/core.html#loglevel">LogLevel</a></code> Debug.</p>
148
149</div>
150<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
151<div class="directive-section"><h2><a name="ProxyHTMLEnable" id="ProxyHTMLEnable">ProxyHTMLEnable</a> <a name="proxyhtmlenable" id="proxyhtmlenable">Directive</a></h2>
152<table class="directive">
153<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Turns the proxy_html filter on or off.</td></tr>
154<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLEnable <var>On|Off</var></code></td></tr>
155<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyHTMLEnable Off</code></td></tr>
156<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
157<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
158<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
159<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
160module for earlier 2.x versions.</td></tr>
161</table>
162    <p>A simple switch to enable or disable the proxy_html filter.
163    If <code class="module"><a href="/mod/mod_xml2enc.html">mod_xml2enc</a></code> is loaded it will also automatically
164    set up internationalisation support.</p>
165    <p>Note that the proxy_html filter will only act on HTML data
166    (Content-Type text/html or application/xhtml+xml) and when the
167    data are proxied.  You can override this (at your own risk) by
168    setting the <var>PROXY_HTML_FORCE</var> environment variable.</p>
169
170</div>
171<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
172<div class="directive-section"><h2><a name="ProxyHTMLEvents" id="ProxyHTMLEvents">ProxyHTMLEvents</a> <a name="proxyhtmlevents" id="proxyhtmlevents">Directive</a></h2>
173<table class="directive">
174<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify attributes to treat as scripting events.</td></tr>
175<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLEvents <var>attribute [attribute ...]</var></code></td></tr>
176<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
177<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
178<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
179<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
180for earlier 2.x versions</td></tr>
181</table>
182<p>Specifies one or more attributes to treat as scripting events and
183apply <code class="directive">ProxyHTMLURLMap</code>s to where enabled.
184You can specify any number of attributes in one or more
185<code>ProxyHTMLEvents</code> directives.</p>
186<p>Normally you'll set this globally.  If you set ProxyHTMLEvents in more than
187one scope so that one overrides the other, you'll need to specify a complete
188set in each of those scopes.</p>
189<p>A default configuration is supplied in <var>proxy-html.conf</var>
190and defines the events in standard HTML 4 and XHTML 1.</p>
191
192</div>
193<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
194<div class="directive-section"><h2><a name="ProxyHTMLExtended" id="ProxyHTMLExtended">ProxyHTMLExtended</a> <a name="proxyhtmlextended" id="proxyhtmlextended">Directive</a></h2>
195<table class="directive">
196<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether to fix links in inline scripts, stylesheets,
197and scripting events.</td></tr>
198<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLExtended <var>On|Off</var></code></td></tr>
199<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyHTMLExtended Off</code></td></tr>
200<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
201<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
202<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
203<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
204for earlier 2.x versions</td></tr>
205</table>
206<p>Set to <code>Off</code>, HTML links are rewritten according to the
207<code class="directive">ProxyHTMLURLMap</code> directives, but links appearing
208in Javascript and CSS are ignored.</p>
209<p>Set to <code>On</code>, all scripting events (as determined by
210<code class="directive">ProxyHTMLEvents</code>) and embedded scripts or
211stylesheets are also processed by the <code class="directive">ProxyHTMLURLMap</code>
212rules, according to the flags set for each rule.  Since this requires more
213parsing, performance will be best if you only enable it when strictly necessary.
214</p><p>
215You'll also need to take care over patterns matched, since the parser has no
216knowledge of what is a URL within an embedded script or stylesheet.
217In particular, extended matching of <code>/</code> is likely to lead to
218false matches.
219</p>
220
221</div>
222<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
223<div class="directive-section"><h2><a name="ProxyHTMLFixups" id="ProxyHTMLFixups">ProxyHTMLFixups</a> <a name="proxyhtmlfixups" id="proxyhtmlfixups">Directive</a></h2>
224<table class="directive">
225<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Fixes for simple HTML errors.</td></tr>
226<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLFixups <var>[lowercase] [dospath] [reset]</var></code></td></tr>
227<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
228<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
229<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
230<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
231for earlier 2.x versions</td></tr>
232</table>
233<p>This directive takes one to three arguments as follows:</p>
234<ul>
235<li><code>lowercase</code> Urls are rewritten to lowercase</li>
236<li><code>dospath</code> Backslashes in URLs are rewritten to forward slashes.</li>
237<li><code>reset</code> Unset any options set at a higher level in the configuration.</li>
238</ul>
239<p>Take care when using these.  The fixes will correct certain authoring
240mistakes, but risk also erroneously fixing links that were correct to start with.
241Only use them if you know you have a broken backend server.</p> 
242
243</div>
244<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
245<div class="directive-section"><h2><a name="ProxyHTMLInterp" id="ProxyHTMLInterp">ProxyHTMLInterp</a> <a name="proxyhtmlinterp" id="proxyhtmlinterp">Directive</a></h2>
246<table class="directive">
247<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enables per-request interpolation of
248<code class="directive">ProxyHTMLURLMap</code> rules.</td></tr>
249<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLInterp <var>On|Off</var></code></td></tr>
250<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyHTMLInterp Off</code></td></tr>
251<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
252<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
253<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
254<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
255for earlier 2.x versions</td></tr>
256</table>
257    <p>This enables per-request interpolation in
258    <code class="directive">ProxyHTMLURLMap</code> to- and from- patterns.</p>
259    <p>If interpolation is not enabled, all rules are pre-compiled at startup.
260    With interpolation, they must be re-compiled for every request, which
261    implies an extra processing overhead.  It should therefore be
262    enabled only when necessary.</p>
263
264</div>
265<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
266<div class="directive-section"><h2><a name="ProxyHTMLLinks" id="ProxyHTMLLinks">ProxyHTMLLinks</a> <a name="proxyhtmllinks" id="proxyhtmllinks">Directive</a></h2>
267<table class="directive">
268<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Specify HTML elements that have URL attributes to be rewritten.</td></tr>
269<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLLinks <var>element attribute [attribute2 ...]</var></code></td></tr>
270<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
271<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
272<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
273<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
274for earlier 2.x versions</td></tr>
275</table>
276<p>Specifies elements that have URL attributes that should be rewritten
277using standard <code class="directive">ProxyHTMLURLMap</code>s.  You will need one
278ProxyHTMLLinks directive per element, but it can have any number of attributes.</p>
279<p>Normally you'll set this globally.  If you set ProxyHTMLLinks in more than
280one scope so that one overrides the other, you'll need to specify a complete
281set in each of those scopes.</p>
282<p>A default configuration is supplied in <var>proxy-html.conf</var>
283and defines the HTML links for standard HTML 4 and XHTML 1.</p>
284
285</div>
286<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
287<div class="directive-section"><h2><a name="ProxyHTMLMeta" id="ProxyHTMLMeta">ProxyHTMLMeta</a> <a name="proxyhtmlmeta" id="proxyhtmlmeta">Directive</a></h2>
288<table class="directive">
289<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Turns on or off extra pre-parsing of metadata in HTML
290<code>&lt;head&gt;</code> sections.</td></tr>
291<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLMeta <var>On|Off</var></code></td></tr>
292<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyHTMLMeta Off</code></td></tr>
293<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
294<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
295<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
296<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
297module for earlier 2.x versions.</td></tr>
298</table>
299    <p>This turns on or off pre-parsing of metadata in HTML
300    <code>&lt;head&gt;</code> sections.</p>
301    <p>If not required, turning ProxyHTMLMeta Off will give a small
302    performance boost by skipping this parse step.  However, it
303    is sometimes necessary for internationalisation to work correctly.</p>
304    <p>ProxyHTMLMeta has two effects.  Firstly and most importantly
305    it enables detection of character encodings declared in the form</p>
306    <pre>&lt;meta http-equiv="Content-Type" content="text/html;charset=<var>foo</var>"&gt;</pre>
307    <p>or, in the case of an XHTML document, an XML declaration.
308    It is NOT required if the charset is declared in a real HTTP header
309    (which is always preferable) from the backend server, nor if the
310    document is <var>utf-8</var> (unicode) or a subset such as ASCII.
311    You may also be able to dispense with it where documents use a
312    default declared using <code class="directive"><a href="/mod/mod_xml2enc.html#xml2encdefault">xml2EncDefault</a></code>, but that risks propagating an
313    incorrect declaration.  A <code class="directive">ProxyHTMLCharsetOut</code>
314    can remove that risk, but is likely to be a bigger processing
315    overhead than enabling ProxyHTMLMeta.</p>
316    <p>The other effect of enabling ProxyHTMLMeta is to parse all
317    <code>&lt;meta http-equiv=...&gt;</code> declarations and convert
318    them to real HTTP headers, in keeping with the original purpose
319    of this form of the HTML &lt;meta&gt; element.</p>
320
321</div>
322<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
323<div class="directive-section"><h2><a name="ProxyHTMLStripComments" id="ProxyHTMLStripComments">ProxyHTMLStripComments</a> <a name="proxyhtmlstripcomments" id="proxyhtmlstripcomments">Directive</a></h2>
324<table class="directive">
325<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Determines whether to strip HTML comments.</td></tr>
326<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLStripComments <var>On|Off</var></code></td></tr>
327<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxyHTMLStripComments Off</code></td></tr>
328<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
329<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
330<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
331<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
332for earlier 2.x versions</td></tr>
333</table>
334<p>This directive will cause mod_proxy_html to strip HTML comments.
335Note that this will also kill off any scripts or styles embedded in
336comments (a bogosity introduced in 1995/6 with Netscape 2 for the
337benefit of then-older browsers, but still in use today).
338It may also interfere with comment-based processors such as SSI or ESI:
339be sure to run any of those <em>before</em> mod_proxy_html in the
340filter chain if stripping comments!</p>
341
342</div>
343<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
344<div class="directive-section"><h2><a name="ProxyHTMLURLMap" id="ProxyHTMLURLMap">ProxyHTMLURLMap</a> <a name="proxyhtmlurlmap" id="proxyhtmlurlmap">Directive</a></h2>
345<table class="directive">
346<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Defines a rule to rewrite HTML links</td></tr>
347<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxyHTMLURLMap <var>from-pattern to-pattern [flags] [cond]</var></code></td></tr>
348<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
349<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
350<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_html</td></tr>
351<tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Version 2.4 and later; available as a third-party
352module for earlier 2.x versions.</td></tr>
353</table>
354<p>This is the key directive for rewriting HTML links.  When parsing a document,
355whenever a link target matches <var>from-pattern</var>, the matching
356portion will be rewritten to <var>to-pattern</var>, as modified by any
357flags supplied and by the <code class="directive">ProxyHTMLExtended</code>
358directive.</p>
359
360<p>The optional third argument may define any of the following
361<strong>Flags</strong>.  Flags are case-sensitive.</p>
362<dl>
363<dt>h</dt>
364<dd><p>Ignore HTML links (pass through unchanged)</p></dd>
365<dt>e</dt>
366<dd><p>Ignore scripting events (pass through unchanged)</p></dd>
367<dt>c</dt>
368<dd><p>Pass embedded script and style sections through untouched.</p></dd>
369
370<dt>L</dt>
371<dd><p>Last-match.  If this rule matches, no more rules are applied
372(note that this happens automatically for HTML links).</p></dd>
373<dt>l</dt>
374<dd><p>Opposite to L.  Overrides the one-change-only default
375behaviour with HTML links.</p></dd>
376<dt>R</dt>
377<dd><p>Use Regular Expression matching-and-replace.  <code>from-pattern</code>
378is a regexp, and <code>to-pattern</code> a replacement string that may be
379based on the regexp.  Regexp memory is supported: you can use brackets ()
380in the <code>from-pattern</code> and retrieve the matches with $1 to $9
381in the <code>to-pattern</code>.</p>
382
383<p>If R is not set, it will use string-literal search-and-replace.
384The logic is <em>starts-with</em> in HTML links, but
385<em>contains</em> in scripting events and embedded script and style sections.
386</p>
387</dd>
388<dt>x</dt>
389<dd><p>Use POSIX extended Regular Expressions.  Only applicable with R.</p></dd>
390<dt>i</dt>
391<dd><p>Case-insensitive matching.  Only applicable with R.</p></dd>
392
393<dt>n</dt>
394<dd><p>Disable regexp memory (for speed).  Only applicable with R.</p></dd>
395<dt>s</dt>
396<dd><p>Line-based regexp matching.  Only applicable with R.</p></dd>
397<dt>^</dt>
398<dd><p>Match at start only.  This applies only to string matching
399(not regexps) and is irrelevant to HTML links.</p></dd>
400<dt>$</dt>
401<dd><p>Match at end only.  This applies only to string matching
402(not regexps) and is irrelevant to HTML links.</p></dd>
403<dt>V</dt>
404<dd><p>Interpolate environment variables in <code>to-pattern</code>.
405A string of the form <code>${varname|default}</code> will be replaced by the
406value of environment variable <code>varname</code>.  If that is unset, it
407is replaced by <code>default</code>.  The <code>|default</code> is optional.</p>
408<p>NOTE: interpolation will only be enabled if
409<code class="directive">ProxyHTMLInterp</code> is <var>On</var>.</p>
410</dd>
411
412<dt>v</dt>
413<dd><p>Interpolate environment variables in <code>from-pattern</code>.
414Patterns supported are as above.</p>
415<p>NOTE: interpolation will only be enabled if
416<code class="directive">ProxyHTMLInterp</code> is <var>On</var>.</p>
417</dd>
418</dl>
419
420<p>The optional fourth <strong>cond</strong> argument defines a condition
421that will be evaluated per Request, provided
422<code class="directive">ProxyHTMLInterp</code> is <var>On</var>.
423If the condition evaluates FALSE the map will not be applied in this request.
424If TRUE, or if no condition is defined, the map is applied.</p>
425<p>A <strong>cond</strong> is evaluated by the <a href="/expr.html">Expression Parser</a>.  In addition, the simpler syntax of conditions
426in mod_proxy_html 3.x for HTTPD 2.0 and 2.2 is also supported.</p>
427
428</div>
429</div>
430<div class="bottomlang">
431<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_html.html" title="English">&nbsp;en&nbsp;</a> |
432<a href="/fr/mod/mod_proxy_html.html" hreflang="fr" rel="alternate" title="Fran�ais">&nbsp;fr&nbsp;</a></p>
433</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
434<script type="text/javascript"><!--//--><![CDATA[//><!--
435var comments_shortname = 'httpd';
436var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_proxy_html.html';
437(function(w, d) {
438    if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
439        d.write('<div id="comments_thread"><\/div>');
440        var s = d.createElement('script');
441        s.type = 'text/javascript';
442        s.async = true;
443        s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
444        (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
445    }
446    else { 
447        d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
448    }
449})(window, document);
450//--><!]]></script></div><div id="footer">
451<p class="apache">Copyright 2014 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
452<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
453if (typeof(prettyPrint) !== 'undefined') {
454    prettyPrint();
455}
456//--><!]]></script>
457</body></html>