Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2011-10-10
Medium Priority
Last Modified: 2012-05-12
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,

Question by:Paweld
  • 3
  • 3
LVL 21

Assisted Solution

Papertrip earned 150 total points
ID: 36943774
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?

Nope, DNS has nothing to do with ports.  The best way to achieve this is probably using some sort of rewrite rules or redirection in IIS, however I'm not an expert on that part so hopefully others can help.

LVL 23

Expert Comment

ID: 36944713
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

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

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.

Author Comment

ID: 36961020
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, 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)
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

LVL 23

Expert Comment

ID: 36961034
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.

Author Comment

ID: 36961487
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?
LVL 23

Accepted Solution

jakethecatuk earned 1350 total points
ID: 36961606
You can't do what you want to achieve.

www.clientsite.com will have an IP address - i.e.  www.ourdomain.com will have an IP address of

If you type into a browser, www.clientsite.com your PC will find the IP address from DNS and connect to that site.  Regardless of anything after the '/', the PC will always connect to

One way around your problem would be to have a new domain called app.clientsite.com which you would point to the IP address of  You can then use IIS bindings to keep traffic separate on your webserver.

Author Closing Comment

ID: 37040023
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!

Featured Post

Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A safe way to clean winsxs folder from your windows server 2008 R2 editions
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question