I am trying to figure out a way to give IP:PORT/SOMEPATH
a DNS entry. For example we have multiple services as the URLs IP:PORT/APP1, IP:PORT/APP2
, etc. Can I use DNS to alias these any way?
It looks like A records are for just IP
, and SRV
records can be used for IP:PORT
: http://www.networksolutions.com/support/how-to-manage-advanced-dns-records/
Is this impossible with DNS? I guess the question is, can you alias any valid URL with some type of DNS record?
EDIT: this question is related but they specifically asked about CNAME records and I'm asking if there isany record type to achieve this: Can a CNAME DNS record point to a subdirectory
With a modern web browser, you would use DNS
CNAME
records to give each application server a unique name all pointing at your web server. The web server would then use virtual hosting based on theHost:
HTTP header that the browser passes in (in apache, theServerAlias
directive).While DNS does have a
URI
record type, I don't know how widely that's implemented.DNS only maps names to IP's, so no, you can't map protocols, ports or paths.
The normal way to do what you want would be to set up virtual hosts. This is where the web server looks at the content of the "Host" request header the client sends and directs the request to the correct application. You can then just make a different sub domain for each app and don't need to worry about ports.
You don't specify which web server you're using but 99% of them will do this.
SRV records will allow you specify the port a well known service running on but not an arbitrary application. They're not widely supported however (by web clients anyway).