LOG IN SIGN UP
Documentation

Adding CNAME records

  Last updated November 16, 2017

This guide describes how to choose the right hostname and how to update the CNAME record for your domain with your DNS provider. Choosing the appropriate CNAME record is the final step required before Fastly can start acting as a reverse proxy and begin routing client traffic through Fastly services instead of directly to your origin.

Before you begin

Before you add a DNS CNAME record, keep in mind the following:

Choosing the right Fastly hostname for your CNAME record

To successfully update your DNS CNAME record, you must choose the right Fastly hostname to use. The hostname you choose will differ based on:

We've provided recommendations below based on these criteria.

Non-TLS hostnames and limiting traffic

If you don't require TLS support and only need to accept HTTP (Port 80) connections, use one of the following hostnames:

TLS-enabled hostnames

If you've purchased either a Shared TLS Certificate or Shared TLS Wildcard Certificate service, use one of the following HTTP/1.x and HTTP/2 enabled hostnames:

When you purchase one of these certificate services, Fastly Support will add your domains to a specific TLS Certificate, usually differentiated by a certificate letter (e.g., a, a2, b, c). You'll need to add the appropriate certificate letter to the beginning of the Fastly hostname noted above for use in your CNAME record. For example, if your domain was added to our a certificate and was being routed through Fastly's entire global network, the above hostname would become:

a.shared.global.fastly.net.

Customer-specific hostnames

If you've purchased our Hosting Service for Customer-Provided TLS Certificates or our Customer-Provided TLS Certificate Hosting Service option, we'll assign you to a specific domain map that uses the following format:

[name].map.fastly.net.

Free TLS wildcard Certificate

If you plan to accept both HTTP (port 80) and HTTPS (port 443) connections and you're using Fastly's free shared TLS wildcard certificate, use:

[name].global.ssl.fastly.net.

Updating the CNAME record with your DNS provider

Once you've determined the appropriate Fastly hostname for your domain, the next step is to create a CNAME record for your domain. The steps you follow will vary depending on your DNS provider's control panel interfaces. Refer to your DNS provider's documentation for exact instructions on how to create or update a CNAME record.

If you run your own DNS server or are familiar with the format of BIND zone files, the CNAME record would look similar to this:

www.example.com.    3600    IN    CNAME   nonssl.global.fastly.net.

In the above example, the domain set up on Fastly is www.example.com., with a time-to-live (TTL) of 3600 seconds (1 hour), the Record Type is CNAME, and the Fastly hostname is nonssl.global.fastly.net. because TLS support isn't required and traffic will be routed through Fastly's entire global network.

Best practices when updating a DNS CNAME record

Checking your CNAME record

To check your CNAME record, run the following command in a terminal window:

dig www.example.com +short

Your output should appear similar to the following:

nonssl.global.fastly.net.
151.101.117.57

In most cases, the hostname displayed first will be your current Fastly hostname (in this case, nonssl.global.fastly.net.). If you don't see a Fastly hostname in the output or if you see an incorrect Fastly hostname, then either your CNAME isn't properly set at your DNS provider or an older CNAME record is still cached by your local DNS resolver.

You can use various online DNS query tools like OpenDNS Cache Check or whatsmydns.net to test the current DNS responses from the different DNS resolvers worldwide.

Removing CNAME records

If you deactivate a service, delete a service, or cancel your account, we strongly recommend modifying or deleting any CNAME records pointing to Fastly hostnames. Follow the instructions on your DNS provider's website. Doing so will minimize the risk of unauthorized use of your domains.


Additional resources:


Back to Top