Can I route web traffic to 2 different hosts based on URL under 1 IP Address?
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Can I route web traffic to 2 different hosts based on URL under 1 IP Address?
I have two internal web servers. One is IIS the other is Apache/Tomcat. Does anyone know if it is possible to have a linux router or something like it to forward traffic to the relevant server based on the url they have entered?
You can also set this up in Apache, possibly in IIS as well.
Point both URLs to the Apache box and then in the apache config, add a redirect. Some info on this can be found at http://httpd.apache.org/docs/mod/mod_alias.html
I like both of these solutions, which do you think would be better. Basically it is for this:
IIS running exchange outlook web access
Apache running on Linux for a simple helpdesk app (forgot about that one)
Tomcat for a Java based eccommerce site that could end up with a bit of traffic.
Each of these will be on completely different domain names, but should all be accessible via port 80
One concern I might mention is if the Tomcat server got a lot of traffic it may not be wise having apache doing all the sorting? Also, because of the ecommerce I could see the Linux box doing some load balancing for redundant internet links, so I'm assuming if we are using it like a router Apache would be a bad Idea? ie more of a security risk?
if yes, I never have done it, but you can forward all packets from the router to the linux box wich contains the virtual domains, then in the virtal domain you choose if deliver local, or redirect to the other server using the redirect directive of the other post.
but i'm not shure it works even if the redirected server is not nated.
I think I understand what you mean, however there may be other servers added to the mix and while they probably won't be web servers I think it would be good to have the first router handle it (or the first hop). I believe what you are talking about is present in many cheaper routers and is called a DMZ. However it just really means forward all traffic to this ip unless otherwise specified. Is that what you meant?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.