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