You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modproxy-dev@apache.org by Nicolas Brasseur <ni...@yahoo.com> on 2002/08/17 17:20:16 UTC
How to use different server based on the url ???
Hello can anybody please tell me if it is possible to
reroute requests to another web server based on the
url used ...
I have an apache web server on a machine, and a lotus
domino server on another machine. I have a domain name
loop.be pointing to a router that re-route requests
addressed to the port 80 to the apache server. I would
like that when the url is www.loop.be the HTTP
requests are re-routed to the apache server (normal
way) and when the url used is mail.loop.be the HTTP
requests should be forwarded to the domino server.
In other terms, is apache able to "forward" requests
based on the url used ...
Am I clear enough ?
Thanks for your answers ...
Nicolas
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
Re: How to use different server based on the url ???
Posted by Brett Hutley <br...@hutley.net>.
Nicolas Brasseur wrote:
>Hello can anybody please tell me if it is possible to
>reroute requests to another web server based on the
>url used ...
>I have an apache web server on a machine, and a lotus
>domino server on another machine. I have a domain name
>loop.be pointing to a router that re-route requests
>addressed to the port 80 to the apache server. I would
>like that when the url is www.loop.be the HTTP
>requests are re-routed to the apache server (normal
>way) and when the url used is mail.loop.be the HTTP
>requests should be forwarded to the domino server.
>In other terms, is apache able to "forward" requests
>based on the url used ...
>
Yup, definitely. Use mod_rewrite and mod_proxy. You'll need to build a
version of apache with these compiled in or loaded as modules (since
they are not included by default). You want to set up a rewrite rule
with a regex that matches the address you want to proxy and get it to
handle the other stuff locally. I believe that you'll only be able to do
it with HTTP/1.1 requests since your rewrite rule will depend on having
a RewriteCond using the %{HTTP_HOST} variable.
I'm pretty much a mod_rewrite novice, but I'll make a quick stab at
solving the problem (although someone with more experience PLEASE chime
in at this port...):
RewriteEngine on
RewriteCond %{*HTTP_HOST*} ^mail.loop.be$
RewriteRule ^(.+) http://domino.server/$1 [P,L]
RewriteRule ^/(.*) - [L]
The first rewrite rule depends on the condition of the HTTP_Host being
mail.loop.be. It then proxies the request to your domino server and
stops rewriting. The second rule says to serve the remaining matches
locally.
HTH,
Brett
Re: How to use different server based on the url ???
Posted by Brett Hutley <br...@hutley.net>.
Graham Leggett wrote:
> Nicolas Brasseur wrote:
*snip*
>
> Use mod_proxy and virtual hosts:
*snip*
>
> You can also use mod_rewrite in there, but using virtual hosts is
> cleaner and more flexible a solution.
Doh. *slaps forehead*... yup much neater. It's scary - I'm starting to
see everything as a problem calling for a mod_rewrite solution :)
Cheers, Brett
Re: How to use different server based on the url ???
Posted by Graham Leggett <mi...@sharp.fm>.
Nicolas Brasseur wrote:
> Hello can anybody please tell me if it is possible to
> reroute requests to another web server based on the
> url used ...
> I have an apache web server on a machine, and a lotus
> domino server on another machine. I have a domain name
> loop.be pointing to a router that re-route requests
> addressed to the port 80 to the apache server. I would
> like that when the url is www.loop.be the HTTP
> requests are re-routed to the apache server (normal
> way) and when the url used is mail.loop.be the HTTP
> requests should be forwarded to the domino server.
> In other terms, is apache able to "forward" requests
> based on the url used ...
Use mod_proxy and virtual hosts:
NameVirtualHost ip.add.re.ss:80
<VirtualHost ip.add.re.ss:80>
ServerName www.loop.be
ProxyPass / http://apache/
ProxyPassReverse / http://apache/
</VirtualHost>
<VirtualHost ip.add.re.ss:80>
ServerName mail.loop.be
ProxyPass / http://domino/
ProxyPassReverse / http://domino/
</VirtualHost>
You can also use mod_rewrite in there, but using virtual hosts is
cleaner and more flexible a solution.
Regards,
Graham
--
-----------------------------------------
minfrin@sharp.fm
"There's a moon
over Bourbon Street
tonight..."