0

I am trying to get my head around Windows, Networks and Domains.

I currently have a server - svr. This is on my domain companyname.co.uk

I can connect to server and ping both svr and svr.companyname.co.uk.

On this server I have a number of applications with web access; TeamCity, Octopus etc. We currently connect to them by browsing to svr:xxxx where xxxx is the port of the web app host (http://svr:9090/ for TC)

I want to create friendly alias' - for example teamcity.companyname.co.uk would point at svr:9090, octopus.companyname.co.uk would point to svr:8090.

However, not being experienced in this area I can't seem to find relevant documents or sites that fully explain what I am looking for.

1 Answers1

1

First, to make one thing clear: when you visit a web page like http://example.com, your web browser is actually making a request to example.com:80. This is done transparently because port 80 is the standard port for the HTTP protocol. As you know, you can request a non-standard port by appending it to the domain name in the URL: http://example.com:888/.

Unfortunately, you cannot have a domain name "alias" that somehow includes a non-standard port - your browser will always try to use port 80 if you don't specify a port.

One solution would be to use a proxy - nginx, apache, lighttpd, and others can all do this.

The idea is that you set up a proxy server that is listening on port 80 on your host. It waits for connections, then forwards those connections to a different server (on the same host, or on a different one) based on some rule. So, for example, you might have rules that look something like this:

IF host = teamcity.companyname.co.uk THEN forward to teamcity:9090
IF host = octopus.companyname.co.uk THEN forward to octopus:8090

The syntax for these rules vary widely between different proxy configurations, so this is just an example.

Note that this is not a redirect - the user's browser connects to teamcity.companyname.co.uk for all requests. It's the proxy that sends the request on to a different service and forwards any responses back to the client "behind the scenes".

These proxy configurations can get quite complex. For example, what if your teamcity application serves a page with a link on it that points to http://teamcity:9090/path/to/page? The user's browser is going to fail if they click on that link. Fortunately, proxies can be configured to rewrite URLs like this on the fly. You'll need to do some research to tailor this solution to your situation.

Kryten
  • 15,230
  • 6
  • 45
  • 68
  • This makes perfect sense. So if I wanted to have, for example, octopus.companyname.co.uk, and teamcity.companyname.co.uk, I would not be able to have them on the same server as I would need to have them both on port 80. Once they are on port 80 then I can create a CNAME from svrX to Octopus/TeamCity. Effectively if I did octopus.companyname.co.uk it would go to svrY:80.companyname.co.uk and teamcity.companyname.co.uk it would go to svrX:80.companyname.co.uk – swankyprogramming Aug 24 '17 at 15:35
  • You could put multiple apps on the same server, provided they are listening on different ports. The proxy doesn't care where the apps are, as long as they are listening for connections. – Kryten Aug 24 '17 at 20:39