Re: Mod_Rewrite and reverse proxy

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

 



 On April 20, 2011 18:43 , Joel Donahue <joel.donahueis@xxxxxxxxx> wrote:
Is it possible to use Mod_Rewrite and apache in reverse proxy mode
simultaneously?

<Directory />
RewriteEngine on
RewriteBase /
RewriteRule ^robots\.txt$ robots2.txt
</Directory>

ProxyPass / http://www.server2/ retry=0
ProxyPassReverse / http://www.server2/
ProxyPreserveHost On


Yes, but the <Directory> stanza applies to files that are being served from the front-end server's filesystem. The rewrite rules you put in the <Directory> stanza have no effect because the requests are being proxied, not served from the filesystem.

Move the RewriteEngine and RewriteRule directives out of the <Directory> context and into the virtual host context with the ProxyPass directive. You should also get rid of the RewriteBase directive and make the RewriteRule directive operate on absolute (not relative) URLs, like this:

RewriteRule ^/robots\.txt$ /robots2.txt

--
  Mark Montague
  mark@xxxxxxxxxxx


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
  "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[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