Do I Need Reverse Proxy?

Do I Need Reverse Proxy?

am 21.03.2007 14:42:55 von Tod Thomas

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:


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


However I don't want to proxy every request to http://myserver, just
requests to http://myserver/portal. When I try this:


ProxyRequests Off
ProxyPreserveHost On
ProxyPass /portal/ http://localhost:8080/
ProxyPassReverse /portal/ http://localhost:8080/



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

Re: Do I Need Reverse Proxy?

am 21.03.2007 15:15:47 von Robin-David Hammond

Mod_rewrite might do this. It can cause the user to enter one uri, but
apache to rewrite the uri BEFORE parsing it.


Robin-David Hammond KB3IEN
50 West 17th Street
Ninth Floor
New York, NY 10011
+1 212 479.1700 x 1729


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:
>
>
> ProxyRequests Off
> ProxyPreserveHost On
> ProxyPass / http://localhost:8080/
> ProxyPassReverse / http://localhost:8080/
>

>
> However I don't want to proxy every request to http://myserver, just requests
> to http://myserver/portal. When I try this:
>
>
> ProxyRequests Off
> ProxyPreserveHost On
> ProxyPass /portal/ http://localhost:8080/
> ProxyPassReverse /portal/ http://localhost:8080/
>

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

Re: Do I Need Reverse Proxy?

am 22.03.2007 16:01:48 von Tod Thomas

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.


ServerName myserver.chubb.com
RewriteEngine on
RewriteRule /portal http://portal.chubb.com [L,R]
..
..
..




ServerName portal.chubb.com

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

..
..
..



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:
>>
>>
>> ProxyRequests Off
>> ProxyPreserveHost On
>> ProxyPass / http://localhost:8080/
>> ProxyPassReverse / http://localhost:8080/
>>

>>
>> However I don't want to proxy every request to http://myserver, just
>> requests to http://myserver/portal. When I try this:
>>
>>
>> ProxyRequests Off
>> ProxyPreserveHost On
>> ProxyPass /portal/ http://localhost:8080/
>> ProxyPassReverse /portal/ http://localhost:8080/
>>

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