You cannot assign a port number to a domain name or statically-defined host name.
A host name is translated into an IP address and port number is a separate number added to the IP address.
A DNS Service record allows you to define the location of the service including an IP address and port number, but it requires a specific application which would query the DNS for the SRV record.
A browser connecting with the HTTP protocol will always connect to port number 80 (unless the port was specified on the client side http://...:8080/). It won't query DNS for the SRV record.
For your use case, you can configure your HTTP server (or a reverse proxy) to redirect the connection based on the Host HTTP header given by the browser. A feature commonly referred to as "virtual hosts".
In this scenario your server would listen to exteal connections on port 80 and check what address did the client request. If it was api.abc.com it would forward the connection to the inteal port 8081 (that is most commonly configured add inteal, i.e. 127.0.0.1:8081) otherwise it would serve the content of your regular website.
It is also possible for the HTTPS connections if the client browser supports SNI (and most current browsers do).
Recent Questions...
ما را در سایت Recent Questions دنبال میکنید
برچسب:
نویسنده: استخدام کار
بازدید: 333
تاريخ: چهارشنبه
30 تير
1395 ساعت: 13:32