Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
redirecting port for domains [iptables]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Leachim
n00b
n00b


Joined: 25 Feb 2007
Posts: 66

PostPosted: Sat Jun 21, 2008 8:21 pm    Post subject: redirecting port for domains [iptables] Reply with quote

Hi all... I have one problem.. I need to redirect port 80 to other ports on server. I mean... I have 3 different apache server running on ports 80, 88, 8080. And redirect will be:

Code:
www.domain1.com:80 -> www.domain1.com:80
www.domain2.com:80 -> www.domain2.com:88
www.domain3.com:80 -> www.domain3.com:8080


I found an iptables rule

Code:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080


But this will redirect all requests at port 80, not only for domain domain3.

How can I do this?
Back to top
View user's profile Send private message
smerf
l33t
l33t


Joined: 06 Nov 2004
Posts: 778
Location: Polska

PostPosted: Sun Jun 22, 2008 4:28 pm    Post subject: Reply with quote

AFAIK it is not possible to use in iptables information from http protocol. Why not use name based virtual hosts? You can still run 3 apache servers (i.e. if you need different versions for each domain) - use mod_proxy.
_________________
Microsoft is not the answer, Microsoft is the question, the answer is no.
Back to top
View user's profile Send private message
Leachim
n00b
n00b


Joined: 25 Feb 2007
Posts: 66

PostPosted: Sun Jun 22, 2008 4:55 pm    Post subject: Reply with quote

Its not for apache, its for another service.... Its for Verlihub (DC++ hub servser software).

That was only example to understand, what I need.
Back to top
View user's profile Send private message
smerf
l33t
l33t


Joined: 06 Nov 2004
Posts: 778
Location: Polska

PostPosted: Mon Jun 23, 2008 5:06 am    Post subject: Reply with quote

It is not possible, packet has no information about the way the sender got your IP
(under which name he knows your machine) - the only possibility is, that he will put
this somewhere (like Host: header field in http - it is upper layer protocol specific).

Possible solution is to use multiple IP addresses (one for each domain).
_________________
Microsoft is not the answer, Microsoft is the question, the answer is no.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum