httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lesley Kimmel <>
Subject [users@httpd] Apache 2.2 RewriteRule/Proxypass and general processing flow
Date Fri, 26 Sep 2014 13:20:02 GMT
Hi All!

I'll try to make this as short as I can, but I need some assistance in understanding the Apache
processing flow. I am using Apache 2.2

I have a requirement to disable access to a certain context (say, /xyz) for users of Firefox.
From what I can gather the best way to do this is using mod_rewrite and a RewriteCond %{HTTP_USER_AGENT}.
I also had a proxypass in place for this context and found that no matter where I placed my
RewriteRule the proxy always seemed to occur. This leads me to believe that proxypass takes
precedence over RewriteRule, can you confirm this? So, I ended up with this configuration:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Firefox
RewriteRule ^xyz error/go_away.html [L]       # Message displayed from DOCUMENT_ROOT/error/go_away.html
RewriteRule ^xyz(.*)$ http://targetserver/xyz$1 [P]

I also have a ProxypassReverse outside of the directory block to handle redirects.

In the end I got this to work by including it in the 'Document Root' Directory block. However,
I'd like to understand why when I placed it outside of this Directory block it would seem
to be ignored. I would get an error when accessing the URL that this URL was not found on
the server. From some research I was to believe that mod_rewrite generally hooks itself early
into the process so I would think that a server-level directive would be processed pretty
much before anything else. Why does it act like the rules don't even exist if placed outside
of the directory block?

View raw message