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