We've been making changes to how we organize and display our docs. Our work isn't done but we'd love your feedback.
Getting started
Domains & Origins

Domains & Origins
Request settings
Cache settings
Custom VCL
Image optimization

Access Control Lists
Monitoring and testing
Securing communications
Web Application Firewall

Logging endpoints
Non-Fastly services

Streaming logs
Debugging techniques
Common errors

Account info
Account management
User access and control


    Using Fastly with apex domains

      Last updated June 13, 2019

    Some customers use only their second level or apex domain (e.g., example.com rather than www.example.com) as their canonical domain. Due to limitations in the DNS specification, we don't recommend placing a CNAME record at the apex domain or using the CNAME Flattening (e.g., ALIAS or ANAME) features offered by some DNS providers. Instead, we offer Anycast IP addresses for content that must be hosted on a second-level or apex domain.

    Where problems exist and why

    The DNS instructions in RFC1034 (section 3.6.2) state that, if a CNAME record is present at a node, no other data should be present. This ensures the data for a canonical name and its aliases cannot be different. Because an apex domain requires NS records and usually other records like MX to make it work, setting a CNAME at the apex would break the "no other data should be present" rule.

    In general, the problem with apex domains happens when they fail to redirect to their www equivalents (example.com points nowhere instead of pointing to www.example.com). Two workaround options exist:

    Neither workaround, however, is ideal.

    Anycast option

    Fastly can provide Anycast IP addresses for content that must be hosted on a second-level or apex domain. We do not charge extra for this service, however, you must be using one of Fastly's paid plans (with or without a contract) in order to take advantage of it. Also, if you do use Anycast IP addresses, using these IPs may result in higher rates.

    Our Anycast option allows you to add A or AAAA records that point your apex domain at Fastly. If the Fastly Anycast IP addresses change we will notify you at status.fastly.com. Because Anycast doesn't give us as much flexibility in routing your requests, this option may not be as performant as our CNAME-based system. We recommend you use our CNAME-based system for as much content as possible, particularly for large files or streaming video.

    Contact support@fastly.com and we'll provide you with the Anycast IP addresses.

    Back to Top