LOG IN SIGN UP
Documentation

Working with domains

  Last updated November 16, 2017

Domains are used to route requests to your service. You associate 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 Create a domain page appears.

    the Create a Domain page

  5. Fill out the Create a domain fields as follows:
    • In the Domain Name field, type the 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 Create 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:

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:

{
  "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