1

Topic: To throw port depending on a subdomain

There are 2 subdomains which refer on same  - one.test.ru and two.test.ru. Whether It is possible depending on a subdomain  ports? For example, if the user is connected on two.test.ru:5000, it needs to be thrown on port 5001 (if on one.test.ru:5000 to leave on 5000 port).

2

Re: To throw port depending on a subdomain

The proxy arises. For HTTP there are units for popular web servers.
Well and generally, there should be something for the used protocol that manages to recognize the domain and to redirect request (and the answer) according to a rule.

3

Re: To throw port depending on a subdomain

The strange desire, and service that what? http? nginx or apache?
Generally if it is necessary
http://two.test.ru:80-> localhost:5001
http://one.test.ru:80-> localhost:5000
It too can be made pair lines both in nginx and in apache and even in haproxy (if it is finite ip different) if it not http and for example tcp.

4

Re: To throw port depending on a subdomain

Well, in nginx it would be easy to make it, and here separate application which by default uses 5000 port. And to change it it is impossible.

5

Re: To throw port depending on a subdomain

The client is always connected on an IP address and never - by name.
But, for some protocols, there is this or that mechanism of indication of a name.
For example, for HTTP1/1 - title Host and for SNI - for TLS.