I have an apache 2.4 reverse proxy server setup that gets content from one of two different back end web servers depending on the request URL.
By default all http requests are redirected to https.
However, I need to make two exceptions to the default by allowing two diferent URL's to remain http.
Note that due to domain posting restrictions the reverse-proxy domain is example.com and one of the back end servers is example.org
I have the following configuration for the http (non-secure) apache instance of the reverse proxy:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/this [OR]
RewriteCond %{REQUEST_URI} !^/that
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule ^/that$ /that/ [R=301,L]
<Location /that/>
ProxyPass http://example.org/that/
ProxyPassReverse http://example.org/that/
</Location>
RewriteRule ^/this$ /this/ [R=301,L]
<Location /this/>
ProxyPass http://example.org/
ProxyPassReverse http://example.org/
</Location>
If I browse to http://example.com I am redirected to https://example.com as expected.
If I try browsing to http://example.com/this or http://example.com/that I get the following error:
The page isn’t redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept cookies.
If I only add this or that individually it works without any problems so the error seems to be caused when I add the [OR] flag.
For example, this works:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/this
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteRule ^/this$ /this/ [R=301,L]
<Location /this/>
ProxyPass http://example.org/
ProxyPassReverse http://example.org/
</Location>