CNAME Records Pointing to SRV Record – How to Configure

cname-recorddomainsrv-recordsubdomain

I have multiple services running that I'd like to access through one port. To make something like this work, I have a proxy server running that can redirect clients based on the url they connect with. For example, a client connecting with service1.mydomain.com would get redirected to service 1, and someone else connecting with service2.mydomain.com would get redirected to service 2. I want to do this so I only have to forward one port (for security, and for ease of adding/removing services).

Right now, I have an SRV record that points to this service (a subdomain, and I've verified that it works). Ideally, I'd like to add CNAME records that point to this SRV record for any and all services running behind the proxy. In other words, if this ip:port of this service changes, I'd like to only change one record since they all use the same ip:port. Is this possible?

Minecraft is a good way to demonstrate, so here is an example of what I don't want. I would like to hide each of these services behind one port and target (using only one SRV record) as opposed to creating several SRV records.

Note: These are not web services. I know browsers can't understand SRV records (and aren't supposed to). I have a client application that understands getting the port number from the record. I have verified that it works on that basis.

Best Answer

Is this possible?

No. CName is an alternate name for an IN A. Period. It has zero correlation with SRV and in particular it is part of the HOST NAME resolution. At this point and in this part of DNS there is no concept of a port.

Dead end.

SRV records were bolted onto the system and are not integrated into the DNS core.