Possible Duplicate:
How to use DNS to redirect domain to specific port on my server
So I've been trying to figure out how to redirect a subdomain to a specific port.
Let's assume the application will always request the default port and that default port is, say, 30000. We have sub1.domain.com, sub2.domain.com and sub3.domain.com, all of them pointed at the same IP. I want to redirect the request to sub1.domain.com:30000 to port 31000, sub2 to 32000 and sub3 to 33000. All of them on the same IP.
I've tried socat/netcat and iptables but they all resolve the domains to an IP address which, in this case, is the same so it breaks the redirection.
Any ideas? Is this even possible? I have some networking knowledge and understand layers a bit… The problem here is cross-layer, so I'm not sure there's even a way to do it unless I write a server that listens on that port and redirects based on requested domain… :\
Thank you in advance. :)