Forward a domain to a specific port?

Hi, I've noticed that a lot of server hosts that use multible ports will do something like this for their IP (which is a domain) youname.company.com:1234

Is there any way to just make BLA.company.com redirect to that port without requiering the port un the URL?

Thanks, FRED.

Posted Jul 31, 2015, 8:09 PM UTC

16
GeneralShenanigans•

No. But you can set up "virtual hosts" on the web server so a.company.com and b.company.com are hosted on the same server/port, deciding which page to serve based on the URL requested.

This question might be better for r/sysadmin

5
festeringsore•

The web server could simply be configured to redirect BLA.company.com from port 80 to the other port using mod_proxy.

3
Apachez•

Depends... there are basically two ways to do this:

  1. Client goes to http(s)://BLA.company.com which then uses mod_proxy (or such) and proxy the request to http(s)://youname.company.com:1234

The browser at the client will still say http(s)://BLA.company.com

or

  1. You setup a permanent redirection at http(s)://BLA.company.com who will redirect the client to http(s)://youname.company.com:1234

This way the client type in http(s)://BLA.company.com but within a second or so that will automagically change into http(s)://youname.company.com:1234

The downside with the later method (method 2 above) is that the clients firewall must allow outgoing HTTP(S) connections towards 1234 (which for corporate networks most likely isnt the case, that is normally only TCP80 (HTTP) and TCP443 (HTTPS) are allowed outbound (if the clients are allowed to browse on their own)).

3
demethan•

actually , im not sure for web, but we do this for minecraft server. I m on my phone right now but pm me, I can give you the details later. its a service dns entry. our players just have to put in the domain name and they connect to the set port for that dns entry. one problem is that you won't be able to ping that adresse.

0
asdlkf•

You could do this with policy based routing and NAT/PAT, but I doubt you have the chops to or hardware to set this up.

0
fragmede•

Yes.

You can use a combination of vhosts and reverse proxy so blah.company.com is really foo.company.com:1234.

I have an apache config doing a very similar setup that I can share if you need more info/help.

0