A URI (Uniform Resource Identifier) record in DNS is a relatively uncommon DNS record type used to specify a mapping from a domain name to a URI (e.g., a web address or a service endpoint). It is primarily used for service discovery, allowing clients to look up where a specific service is hosted.
Record Type | Purpose | Maps To | How It Works | Example | Use Cases |
---|---|---|---|---|---|
A (Address Record) | Resolves a domain to an IPv4 address | IP Address (IPv4) | When a user enters a domain name, the DNS resolves it to an IP address for routing. | example.com. IN A 192.0.2.1 | Used for hosting websites, servers, and online services that rely on IPv4. |
AAAA (IPv6 Address Record) | Resolves a domain to an IPv6 address | IP Address (IPv6) | Functions like an A record but supports IPv6 addresses instead of IPv4. | example.com. IN AAAA 2001:db8::1 | Used for websites and services that want to support IPv6 connectivity. |
CNAME (Canonical Name) | Creates an alias for another domain name | Another domain name | If a CNAME record exists, the DNS query resolves to the target domain instead of an IP. | www.example.com. IN CNAME example.com. | Helps manage subdomains by pointing them to the same primary domain without duplicating records. |
MX (Mail Exchange) | Specifies mail servers for handling email | Mail server domain | Defines which mail server should receive emails for the domain. | example.com. IN MX 10 mail.example.com. | Routes emails to the correct mail server for a domain. |
SRV (Service Record) | Defines a host, port, and priority for a service | Hostname & port number | Used in applications where a client needs to locate a service on a network. | _sip._tcp.example.com. IN SRV 10 5 5060 sipserver.example.com. | Used in VoIP, XMPP, and other network services requiring service discovery. |
TXT (Text Record) | Stores arbitrary text data | Free-form text | A simple way to associate extra data with a domain. | example.com. IN TXT "v=spf1 mx -all" | Commonly used for SPF, DKIM, and other domain verifications. |
URI (Uniform Resource Identifier) | Provides a direct service URL | Full URI (e.g., HTTPS, FTP, WebSocket) | A client querying for a URI record gets a direct URL to a service. | _service._tcp.example.com. IN URI 10 1 "https://api.example.com/v1" | Allows automated service discovery where clients can retrieve the actual service URL via DNS. |
Imagine an organization running multiple microservices and APIs. Instead of hardcoding API endpoints in applications, clients can discover them dynamically using DNS.
_api._tcp.example.com. IN URI 10 1 "https://api.example.com/v1"
_api._tcp.example.com
and retrieve the correct API endpoint.A cloud provider offers different services (e.g., object storage, authentication, analytics). Instead of requiring users to manually configure endpoints, a URI record can direct them automatically.
_storage._tcp.example.com. IN URI 10 1 "https://storage.example.com/user123"
_storage._tcp.example.com
and get redirected to the correct URL.SRV records are commonly used for service discovery, but they only return a hostname and port. A URI record returns a complete URL, which can include paths, query parameters, and even different protocols.
_sip._tcp.example.com. IN SRV 10 5 5060 sipserver.example.com.
sip://sipserver.example.com:5060
_sip._tcp.example.com. IN URI 10 1 "sip:sipserver.example.com:5060;transport=tcp"
A content delivery network (CDN) can use URI records to route users to the best regional server dynamically.
_cdn._tcp.example.com. IN URI 10 1 "https://cdn-us.example.com"
_cdn._tcp.example.com. IN URI 20 1 "https://cdn-eu.example.com"
https://cdn-us.example.com
https://cdn-eu.example.com
10
vs. 20
) ensures the best routing.IoT devices (smart home hubs, industrial sensors) often need to connect to a cloud service. Instead of hardcoding URLs into firmware, a URI record can be used for dynamic service discovery.
_iot._tcp.example.com. IN URI 10 1 "mqtt://mqtt-broker.example.com:1883"
Scenario | Better with SRV? | Better with CNAME? | Better with A/AAAA? | Better with URI? |
---|---|---|---|---|
Finding a website’s IP | ❌ | ❌ | ✅ | ❌ |
Redirecting one domain to another | ❌ | ✅ | ❌ | ❌ |
Finding the hostname and port of a service | ✅ | ❌ | ❌ | ❌ |
Finding a full URL for a service | ❌ | ❌ | ❌ | ✅ |
Discovering an API endpoint dynamically | ❌ | ❌ | ❌ | ✅ |
IoT or Cloud service discovery | ❌ | ❌ | ❌ | ✅ |
VoIP or SIP service lookup | ✅ | ❌ | ❌ | ✅ (better if URL needed) |
Would you like a guide on setting up a URI record with a specific DNS provider? 🚀