[users@httpd] Mod_rewrite and mod_proxy

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

 



Hello all,

I've configured an Apache 2.0 instance to work as a reverse proxy,
listening on external.address.com and redirecting to
internal.address.com.

The relevant lines of the httpd.conf file are :

Listen external.address.com:80

<VirtualHost external.address.com:80>
ProxyPass / http://internal.address.com/
ProxyPassReverse / http://internal.address.com/
</VirtualHost>

This works fine, and all our URLs (which look like
http://external.address.com/newsite/whatever) are correctly rerouted to
http://internal.address.com/newsite/whatever

However, we'd like to maintain backwards-compatibility with the old
site. This means that the old URLs such as
http://external.address.com/images/xyz or
http://external.address.com/html/abc should be rewritten as
http://external.address.com/newsite/images/xyz or
http://external.address.com/newsite/html/abc BEFORE going through
mod_proxy. Accordingly, I've tried modifying the VirtualHost section so
:

<VirtualHost external.address.com:80>
RewriteEngine on
RewriteLog /path/to/logs/rewrite_log
RewriteLogLevel 100
RewriteRule ^/images/(.*) /newsite/images/$1 [L]
RewriteRule ^/html/(.*) /newsite/html/$1 [L]
...
ProxyPass / http://internal.address.com/
ProxyPassReverse / http://internal.address.com/
</VirtualHost>

This, however, doesn't work. The log file is created, but stays
desesperately empty, and all the requests to
http://external.address.com/html/abc are directly rerouted to
http://internal.address.com/html/abc

I've tried replacing [L] by [P] or [QSA] in the rules, and placing the
Rewrite directives outside of the VirtualHost section, but that doesn't
change anything. I've read in the archive that using [P] and removing
the ProxyPass directive should work, but that would break the
redirection for the new URLs.

The httpd -l command shows mod_rewrite.c, so the module is indeed here.

Any thoughts on what I'm doing wrong ?

Thanks in advance.

Regards,
Laurent Leconte


***********************************
Ce message et toutes les pieces jointes (ci-apres le "message") sont confidentiels et etablis a l'intention exclusive de
ses destinataires.
Toute utilisation ou diffusion non autorisee est interdite.
Tout message electronique est susceptible d'alteration. Le Groupe France Telecom decline toute responsabilite au titre de
ce message s'il a ete altere, deforme ou falsifie.
Si vous n'etes pas destinataire de ce message, merci de le detruire immediatement et d'avertir l'expediteur.
***********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. Any unauthorised
use or dissemination is prohibited.
Messages are susceptible to alteration. France Telecom Group shall not be liable for the message if altered, changed or
falsified.
If you are not receiver of this message, please cancel it immediately and inform the sender.
***********************************

---------------------------------------------------------------------
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