Link to home
Start Free TrialLog in
Avatar of Paweld
Paweld

asked on

How do I forward requests to different ports based on a domain they came from?

Hi All

Below is a question regarding port forwarding in Linux that someone asked and got a reply
already. I'm just reposting a version modified to my situation.
Could someone help me out on how to do this in Windows Server 2008 please?

My company has a IIS server running an application. They would like to host it from different ports to different clients; how to forward the requests to a specific port based on the domain name?

In a nutshell I want www.firstdomain.com/app to go to 8080 and www.seconddomain.com/app to go to port 8081 seemlessly with sessions etc... (I do not want people to see the trailing port numbers by the way)
We don't host firstdomain nor the seconddomain as they are our customers buying the app so I can't change their DNS records etc.

Also if it turns out that we can modify their dns entries, would it be possible to create a dns record pointing to our server and a port?


Appreciate any help,
Thanks,
Pawel.

SOLUTION
Avatar of Papertrip
Papertrip
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
if you are using specific domain names, then using port numbers isn't really required as you can use host headers and bindings on IIS.

So, you would have your IIS server with the IP address of 1.1.1.1

You would create DNS entries for www.firstdomain.com and www.seconddomain.com and give them the same IP address of 1.1.1.1

On your IIS server, you would have multiple websites and under the properties, you would specify the URL that the website should accept traffic for.

Failing that, you could do this at a firewall level.
Avatar of Paweld
Paweld

ASKER

Thanks guys,

Jakethecatuk - can I only just ask why do I have to create DNS entries?
I found the IIS Bindings as you said, and I can add one of my own so it looks something like this:

Protocol: http;
IP Address: Any assigned or 192.168.0.2, so I chose the latter (I can also type external IP address, which I probably should do?)
Port: I put a port name I want
URL: www.firstdomain.com

Is this what you were talking about? If so, then why do I create DNS entries? Is it because I don't host www.firstdomain.com? I will only host the 'app' bit if it's at all possible (www.firstdomain.com/APP)
you need DNS entries for www.firstdomain.com and www.seconddomain.com etc as they need to know where to find the website - no DNS, then no way to your servers.

Now you've said something which is will probably screw everything up.  You have said '... I will only host the 'app' bit if it's at all possible (www.firstdomain.com/APP)...' - who is going to be hosting www.firstdomain.com?  If it's not on the same server as your APP, then things get very interesting on how to achieve your goal.
Avatar of Paweld

ASKER

Ok, talked to developers and asked how exactly they wanted it:

We will have something like www.ourdomain.com/client_a (one for each client obviously)
www.clientsite.com/APP has to point to a corresponding site on our server.

So technically this could be done with IIS Binding?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Paweld

ASKER

As pointed out by jakethecatuk what we wanted to achieve was not doable.
Instead we will be asking customers to create a subdomain and then point them to our servers
Thanks and sorry for delay!