RE: best way to modify a URL

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

 




From: André Warnier [aw@xxxxxxxxxx]
>>> Considering your latest answer, I am also now inclined to think that
>>> using <VirtualHost> sections would be much cleaner.
>>
>> More efficient, more maintainable, or less code to write to obtain same effect?
>>
> Probably all of the above.
> General idea :

What I probably should have mentioned is that the actual server is on a different machine: 

router (port 80): forward to main server (foo.com)
main server (call it main for simplicity): one Apache server running on port 80
aux server 1 (say, 192.168.3.2, call it aux1): one Apache server running on port 80

The web application running on aux1 can't be modified, and its apache server config should not be touched unless absolutely impossible to do it any other way, so all its content has href's and POST etc that start with /bar/. 

Until now, I had main setup as reverse proxy to access aux1 from WAN: 

ProxyRequests Off
ProxyPass        /bar/ http://192.168.3.2/bar/
ProxyPassReverse /bar/ http://192.168.3.2/bar/

which works fine. 

However the client always sees Location as http://foo.com/bar/*, so recently we were asked if we could hide the /bar/ part and instead access aux1 via http://dodo.foo.com. 

I've spent a couple hours trying various things with the rewriterule to handle the POST requests but can't get it to work:

RewriteCond   %{HTTP_HOST}         ^dodo\.foo\.com$
RewriteCond   %{REQUEST_METHOD}    !GET                      [NC] 
RewriteRule   ^/bar/(.*)           http://foo.com/bar/$1     [P,L]

(tried many different combinations of R, P, L, and the URL substitution to /$1 etc but no success.

So looking at the VirtualHost option, yes perhaps cleaner, but can't get the client's Location to show the friendly URL: 

<VirtualHost *:80>
   ServerName dodo.foo.com
   ProxyRequests off
   ProxyPass           /bar/     http://192.168.3.2/bar/
   ProxyPassReverse    /bar/     http://192.168.3.2/bar/
   ProxyPass           /         http://192.168.3.2/bar/
   ProxyPassReverse    /         http://192.168.3.2/bar/

   #Redirect      permanent /bar/      http://dodo.foo.com/
   #RedirectMatch permanent /bar/(.*)  http://dodo.foo.com/$1
</VirtualHost>

Uncommenting either of the redirect lines doesn't help. 

Oliver



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