Reputation: 31
I have a working configuration that looks like
ProxyPass /roundcube protocol://127.0.0.1:8080/roundcube
ProxyPassReverse /roundcube protocol://127.0.0.1:8080/roundcube
when I go to
http://www.example.com/roundcube
or
https://www.example.com/roundcube
both or properly proxied to the server on 127.0.0.1:8080, as expected.
However, I would like to have more control over when the proxying happens, so I would like to use mod_rewrite's [P] option rather than the ProxyPass directive shown above. I tried the following:
RewriteEngine On
RewriteRule ^/roundcube$ /roundcube/ [R]
RewriteRule ^/roundcube/(.*) protocol://127.0.0.1:8080/roundcube/$1 [P]
ProxyPassReverse /roundcube protocol://127.0.0.1:8080/roundcube
With that configuration, when I go to
http://www.example.com/roundcube
the request proxies correctly as expected.
BUT when I go to
https://www.example.com/roundcube
the request 404's.
So my question is, why does the mod_rewrite proxy not work the same way as the ProxyPass version, in regard to both http and https requests? My two examples above should be functionally equivalent based on my understanding, but that does not seem to be the case. What am I missing? I haven't been able to track down any documentation that would explain this. Thanks!
Upvotes: 3
Views: 4815
Reputation: 39
Although it might be too late, I'm posting this answer in case someone comes to this page with the same problem.
The syntax for ProxyPass is different from that of RewriteRule. In RewriteRule, in order to refer to the protocol, you should use %{SERVER_PROTOCOL}
as explained at http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
Upvotes: 3