Okay, I've confirmed that the following configuration works for httpd
trunk and httpd 2.2.25:
RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule . - [E=protocol:http]
RewriteCond %{HTTPS} =on
RewriteRule . - [E=protocol:https]
RewriteRule ^/my_app/(.*) %{ENV:protocol}://1.2.3.4/my_app/$1 [P]
ProxyPassReverse /my_app/http://1.2.3.4/my_app/
ProxyPassReverse /my_app/https://1.2.3.4/my_app/
So I submit the attached patch to the doc for review.
Thanks,
Mike Rumph
On 9/17/2013 9:32 AM, Jim Jagielski wrote:
+1
On Sep 17, 2013, at 11:32 AM, Jeff Trawick <[email protected]>
<mailto:[email protected]> wrote:
not really a rewrite fan, but I think that's better than code
so IMO we should doc that interpolation isn't supported in the
scheme, and instead a solution like that should be used
Index: docs/manual/mod/mod_proxy.xml
===================================================================
--- docs/manual/mod/mod_proxy.xml (revision 1530700)
+++ docs/manual/mod/mod_proxy.xml (working copy)
@@ -1239,7 +1239,8 @@
<var>${VARNAME}</var>. Note that many of the standard CGI-derived
environment variables will not exist when this interpolation happens,
so you may still have to resort to <module>mod_rewrite</module>
- for complex rules.</p>
+ for complex rules. Also note that the syntax
+ <var>${VARNAME}</var> is not permitted within the scheme portion of a
URL.</p>
<p>Normally, mod_proxy will include the query string when
generating the <var>SCRIPT_FILENAME</var> environment variable.
@@ -1393,8 +1394,25 @@
httpd 2.2.9 and later), used together with
<directive>ProxyPassInterpolateEnv</directive>, enables interpolation
of environment variables specified using the format <var>${VARNAME}</var>.
+ Note that the syntax
+ <var>${VARNAME}</var> is not permitted within the scheme portion of a URL.
+ Dynamic determination of the scheme can be accomplished with
<module>mod_rewrite</module>
+ as in the following example.
</p>
+ <highlight language="config">
+RewriteEngine On
+
+RewriteCond %{HTTPS} =off
+RewriteRule . - [E=protocol:http]
+RewriteCond %{HTTPS} =on
+RewriteRule . - [E=protocol:https]
+
+RewriteRule ^/mirror/foo/(.*) %{ENV:protocol}://backend.example.com/$1 [P]
+ProxyPassReverse /mirror/foo/ http://backend.example.com/
+ProxyPassReverse /mirror/foo/ https://backend.example.com/
+ </highlight>
+
<p>When used inside a <directive type="section" module="core"
>Location</directive> section, the first argument is omitted and the local
directory is obtained from the <directive type="section" module="core"