Apache 2.2 RewriteRule/Proxypass and general processing flow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

Thanks
-Kimmel

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux