Redirecting to other internal servers based on sub domain

Here is my situation

home network, windows machines, 1 external facing IP address (that allows port 80) 1 windows home server always on machine, planning on upgrading to WHS 2011 soon. several IP cameras which use their own webserver and are accessed directly.

My problem/goal:

Id like to be able to externally access my IP cameras and servers on my home network by subdomain, over port 80. ie: cam1.mydomain.com , cam2.mydomain.com, nas.mydomain.com, etc.

They are currently set up with port forwarding, but many networks where I work out of have all non standard ports locked down so I need them to all be on port 80. As I understand it, this cannot be done at the router level and would need to be done at the webserver level, which is fine.

In essence this is just internally routing to different servers depending on subdomain, which Im hoping is a common problem with a relatively simple solution.

let me know if I left anything out. thanks in advance.

(btw, IIS is preferable to apache if all things equal)


If you are accessing the services via HTTP (i.e. in a web browser directly rather than via a plugin or some other client application) then you can do this using something like nginx as a reverse proxy - it can choose where to send each request it proxies for depending on the incoming "host" header line (by having one "server" directive for each sub-domain with its own proxy-pass settings).

You would not be able to do this on your router unless you are running some custom firmware that runs (or allows you to install) a program like nginx that can act as a reverse-proxy like this, but if you port-forward TCP80 to a machine running nginx then the technique will work.

https://help.ubuntu.com/community/Nginx/ReverseProxy gives an example config for nginx as a reverse proxy (there will be many more examples around if you need more). Many other web servers or any apps designed specifically to provide reverse proxy services should be able to do this for you. Apache can if you have mod_proxy (which IIRC is generally present but not loaded by default). IIRC IIS can't without 3rd part add-ons (which may cost) but there are Windows builds of most of the open source tools that can do the job so you can still used them even if you are an entirely Windows environment.