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
Basics
Domains & Origins
Performance

Configuration
Basics
Conditions
Dictionaries
Domains & Origins
Request settings
Cache settings
Headers
Responses
Performance
Custom VCL
Image optimization
Video

Security
Access Control Lists
Monitoring and testing
Securing communications
TLS
Web Application Firewall

Integrations
Logging endpoints
Non-Fastly services

Diagnostics
Streaming logs
Debugging techniques
Common errors

Account info
Account management
Billing
User access and control

Reference

    Working with domains

      Last updated August 21, 2019

    Domains are used to route requests to your service. You associate your domain names with your origin when provisioning a Fastly service, and you can add, edit, or remove domains from your service at any time.

    Creating a domain

    Follow the steps below to add a domain to your service:

    1. Log in to the Fastly web interface and click the Configure link.
    2. From the service menu, select the appropriate service.
    3. Click the Configuration button and then select Clone active. The Domains page appears.

      the Domains page

    4. Click the Create domain button. The domain creation fields appear.

      the Create a Domain page

    5. Fill out the domain creation fields as follows:

      • In the Domain Name field, type your domain name. The domain name is used to properly route requests to your website, and ensures that others cannot serve requests to that domain. For example, you could enter www.example.com, blog.example.com, or even use wildcards such as *.example.com.

      • In the Comment field, optionally type a comment that describes the domain.

    6. Click the Add button. Your new domain appears in the list of domains.
    7. If you haven't already, add CNAME DNS records for your domain name to begin routing client traffic through Fastly services instead of directly to your origin.
    8. Click the Activate button to deploy your configuration changes.

    Using the API

    You can use Fastly's API to programmatically add domains to your service. To add a domain to your service, make the following API call in a terminal application:

    1
    
    curl -H "Fastly-Key: FASTLY_API_TOKEN" -X POST https://api.fastly.com/service/<service_id>/version/<version_id>/domain -d 'name=www.example.com'
    

    The response will look like this:

    1
    2
    3
    4
    5
    6
    
    {
      "comment": "",
      "name": "www.example.com",
      "service_id": "<service_id>",
      "version": <version_id>
    }
    

    Domain creation limits

    We set a limit on the number of domains you can create per service by default. However, if you email support@fastly.com, we may be able to adjust this number for you by working with you to set up and fine-tune domain handling in your service.

    Testing a domain

    You can test a domain to see how your service is being pulled through our network. This can help you identify DNS issues and problems with your Fastly configuration. See our testing guide for instructions.

    Deleting a domain

    Follow the steps below to delete a domain from your service:

    1. On the Domains page, click the trash icon next to the domain you want to delete.
    2. Click the Confirm and delete button to confirm you want to delete your domain.
    3. Click the Activate button to deploy your configuration changes.
    Back to Top