httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tod Thomas <ttho...@chubb.com>
Subject Re: [users@httpd] Do I Need Reverse Proxy?
Date Thu, 22 Mar 2007 15:01:48 GMT
Robin-David Hammond wrote:
> 
> Mod_rewrite might do this. It can cause the user to enter one uri, but 
> apache to rewrite the uri BEFORE parsing it.
> 


Thanks for the feedback.  I got it working with two virutal host 
directives, mod_rewrite and mod_proxy:

NameVirtualHost *:80 <- This is important.  I had commented it out while 
playing with my configuration.

<VirtualHost *:80>
   ServerName       myserver.chubb.com
   RewriteEngine    on
   RewriteRule      /portal   http://portal.chubb.com [L,R]
.
.
.

</VirtualHost>

<VirtualHost *:80>
   ServerName        portal.chubb.com

   ProxyRequests     Off
   ProxyPass        / http://localhost:8080/
   ProxyPassReverse / http://localhost:8080/

.
.
.

</VirtualHost>

This works well as long as I have portal.chubb.com in DNS or the 
requesting client's /etc/hosts file.  Now the question is can I 
accomplish the same thing but have apache resolve the host name locally 
rather than making the client query DNS?


- Tod



> 
> On Wed, 21 Mar 2007, Tod Thomas wrote:
> 
>> I'm running apache v2.2.0, built from scratch, on an FC6 box.  I have 
>> a Tomcat based portal server running from port 8080 on the same box.  
>> The portal itself, upon initial request, redirects the client a couple 
>> of times before it finally rests at a default home page.  I'd like to 
>> accomplish a couple of things.
>>
>> First, any request that arrives to the apache server 
>> http://myserver/portal I'd like forwarded to http://localhost:8080 
>> without the user ever noticing the are leaving http://myserver/portal. 
>> This sounded like a job for reverse proxy.
>>
>> I can get it working just fine if I use this construct:
>>
>> <IfModule mod_proxy.c>
>>  ProxyRequests Off
>>  ProxyPreserveHost On
>>  ProxyPass / http://localhost:8080/
>>  ProxyPassReverse / http://localhost:8080/
>> </IfModule>
>>
>> However I don't want to proxy every request to http://myserver, just 
>> requests to http://myserver/portal. When I try this:
>>
>> <IfModule mod_proxy.c>
>>  ProxyRequests      Off
>>  ProxyPreserveHost  On
>>  ProxyPass         /portal/ http://localhost:8080/
>>  ProxyPassReverse  /portal/ http://localhost:8080/
>> </IfModule>
>>
>>
>> It fails.  I have a feeling it has to do with the multiple redirects 
>> the portal does prior to presenting its initial home page, but I'm not 
>> sure since it works fine pointing to /.
>>
>> Another thing I would like to try and accomplish is to replace 
>> http://localhost:8080 with a virtual domain.  So instead the proxy 
>> example above would 'redirect' to http://virtualdomain:8080.  This 
>> would still be invisible to the user as they would see the traffic 
>> directed to http://myserver/portal.  The virtualdomain's name would be 
>> resolved locally using an entry in /etc/hosts.
>>
>> I'd really like to get the first one working.  The second is more 
>> esoteric but also valuable.
>>
>> Can anyone offer any advice?  Please let me know if there is anything 
>> that needs clarification.
>>
>>
>> Thanks - Tod
>>
>> ---------------------------------------------------------------------
>> 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@httpd.apache.org
>>  "   from the digest: users-digest-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> 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@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 

---------------------------------------------------------------------
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@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message