URI (Uniform Resource Identifier) record in DNS

URI (Uniform Resource Identifier) record in DNS

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.

Detailed Comparison of URI and Other DNS Records

Record TypePurposeMaps ToHow It WorksExampleUse Cases
A (Address Record)Resolves a domain to an IPv4 addressIP 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.1Used for hosting websites, servers, and online services that rely on IPv4.
AAAA (IPv6 Address Record)Resolves a domain to an IPv6 addressIP Address (IPv6)Functions like an A record but supports IPv6 addresses instead of IPv4.example.com. IN AAAA 2001:db8::1Used for websites and services that want to support IPv6 connectivity.
CNAME (Canonical Name)Creates an alias for another domain nameAnother domain nameIf 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 emailMail server domainDefines 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 serviceHostname & port numberUsed 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 dataFree-form textA 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 URLFull 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.

Verbose Use Cases for URI Records

1. API Service Discovery

Imagine an organization running multiple microservices and APIs. Instead of hardcoding API endpoints in applications, clients can discover them dynamically using DNS.

Example

_api._tcp.example.com. IN URI 10 1 "https://api.example.com/v1"
  • A client application can query _api._tcp.example.com and retrieve the correct API endpoint.
  • This allows developers to change API endpoints without updating client-side configurations.

2. Cloud-Based Service Routing

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.

Example

_storage._tcp.example.com. IN URI 10 1 "https://storage.example.com/user123"
  • When a user needs cloud storage, they query _storage._tcp.example.com and get redirected to the correct URL.

3. Alternative to SRV for Web Services

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.

Example (Comparing SRV vs URI)

  • SRV Record for VoIP (SIP)
    _sip._tcp.example.com. IN SRV 10 5 5060 sipserver.example.com.
    • Clients must interpret this as sip://sipserver.example.com:5060
  • URI Record for VoIP (SIP)
    _sip._tcp.example.com. IN URI 10 1 "sip:sipserver.example.com:5060;transport=tcp"
    • Directly returns the complete SIP URI, reducing complexity.

4. CDN and Load Balancing

A content delivery network (CDN) can use URI records to route users to the best regional server dynamically.

Example

_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"
  • North American users get https://cdn-us.example.com
  • European users get https://cdn-eu.example.com
  • The priority (10 vs. 20) ensures the best routing.

5. IoT Device Service Discovery

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.

Example

_iot._tcp.example.com. IN URI 10 1 "mqtt://mqtt-broker.example.com:1883"
  • When an IoT device starts up, it queries DNS to find where to connect.

Why Use a URI Record Instead of Other Records?

ScenarioBetter 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)

Key Takeaways

  1. URI records provide a full URL, unlike SRV records, which only return a hostname and port.
  2. They are useful for API discovery, cloud services, IoT devices, and CDN routing.
  3. They are not widely supported by all DNS providers, so alternatives like SRV or CNAME may be needed.

Would you like a guide on setting up a URI record with a specific DNS provider? 🚀

Leave a Reply

Your email address will not be published. Required fields are marked *