From: Eric Covener Date: Sun, 31 Dec 2017 16:12:24 +0000 (+0000) Subject: xform X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0338089ab03de12e1de03fccfa9826c7484da57f;p=apache xform git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1819740 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_substitute.html.en b/docs/manual/mod/mod_substitute.html.en index b5f9ad2567..b373cc130a 100644 --- a/docs/manual/mod/mod_substitute.html.en +++ b/docs/manual/mod/mod_substitute.html.en @@ -58,6 +58,7 @@ Override:FileInfo Status:Extension Module:mod_substitute +Compatibility:expr= substitution values were added in 2.5.1

The Substitute directive specifies a search and replace pattern to apply to the response body.

@@ -85,8 +86,11 @@ or regex of a subsequent one. -

The substitution is may contain literal text and regular - expression backreferences

+

The substitution may contain literal text and regular + expression backreferences. If the substitution begins with the text + expr= it is intepreted as an + expression which allows access to environment variables and + header values.

Example

<Location "/">
     AddOutputFilterByType SUBSTITUTE text/html
@@ -118,6 +122,18 @@
 </Location>
+

When using an expression for the + substitution, regular expression backreferencwa must be + backslash ('\') escaped as illustrated in the example below:

+

Expression Example

<Location "/">
+    AddOutputFilterByType SUBSTITUTE text/html
+    Substitute "s/example.com/expr=%{HTTP:HOST}/i"
+    Substitute "s/Hello, (\S+)/expr=Hello from %{REQUEST_URI}, \$1,/i"
+</Location>
+
+ + +

A common use scenario for mod_substitute is the situation in which a front-end server proxies requests to a back-end server which returns HTML with hard-coded embedded URLs that refer