Skip to main content

Connect Your Fastly Account to Pantheon

Learn how to connect your Fastly account to the Pantheon platform.


This section provides steps on how to connect your Fastly account to your Pantheon account.

Before You Begin

Verify that you have the following before you begin:

  • A registered domain name.

  • The ability to modify your domain's nameservers.

  • A Pantheon account with a configured WordPress or Drupal site.

  • A Fastly account.

Connect Fastly to Pantheon

Follow the steps below to connect your Fastly account to your Pantheon account.

  1. Sign in to your Fastly account.

  2. Create a New Service and set the Origin service address to the Pantheon sub-domain specific to your main site's Live environment.

    • Sub-domain information can be found under the Domains/SSL tab. It should look similar to: live-{site-name}.pantheon.io.
  3. Enter the site domain you want to serve as the root level in the Domain Name field.

    • Note that Fastly does not serve A names, such as site-example.com. You must use www. Your site domain should look like this: www.site-example.com.
  4. Click Configure after Fastly has finished setting up the service.

  5. Click the Hosts tab, select the + New button, and then add the Pantheon sub-domain for the secondary site's Live environment.

  6. Select the gear icon next to the primary content host, then select Conditions.

  7. Click the + New button and then complete the pop-up fields.

    • You must create a Fastly Condition for each host. Each condition lets Fastly know what traffic needs to be sent to which server. Your field entries should like this:

      • Name: Main Content

      • Apply If...: req.url !~ "^/main"

      • Priority: 2

        • This tells Fastly that any URL that contains /main must be sent to the main server.
  8. Select the gear icon next to the secondary content host, and then select Conditions.

  9. Click the + New button and then complete the pop-up fields.

    • Your field entries should like this:

      • Name: Blog Content

      • Apply If...: req.url ~ "^/blog"

      • Priority: 2

        • This tells Fastly that any URL that contains /blog must be sent to the blog content server.
  10. Click Content, select New, and then complete the pop-up fields to create a custom header for redirected requests.

    • Your entries should look like this:

      • Name: Main_Server_Host
      • Type/Action: Request, Set
      • Destination: http.host
      • Source: live-{site-name}.pantheon.io <-- Main content server's Pantheon subdomain
      • Ignore If Set: No
      • Priority: 10
  11. Click Create and save the new content.

  12. Click the gear icon next to the Main_Server_Host header, and then select Request Conditions.

  13. Click the Name drop-down menu, select the Main_Server_Host_Condition, and then click Assign.

    • This assigns the Main_Server_Host Header to the Main_Server_Host_Condition and appends the header to all traffic sent to the main content server on Pantheon.
  14. Click Content again, select New, and then complete the pop-up fields to create a second custom header for redirected requests.

    • Your entries should look like this:

      • Name: Blog_Server_Host
      • Type/Action: Request, Set
      • Destination: http.host
      • Source: live-{site-name}.pantheon.io <-- Secondary content server's Pantheon subdomain
      • Ignore If Set: No
      • Priority: 10
  15. Click Create and save the new content.

  16. Click the gear icon next to the Main_Server_Host header, and then select Request Conditions.

  17. Click the Name drop-down menu, select Blog_Server_Host_Condition, and then click Assign.

    • This assigns the Main_Server_Host Header to the Blog_Server_Host_Condition and appends the header to all traffic sent to the main content server on Pantheon.

Test Your Setup

Follow the steps below to confirm that your Fastly account is working correctly with your Pantheon account.

  1. Open a new browser tab and load the main URL, for example: http://www.example-site.com/.

  2. Verify that the website loads correctly and appends the directory that serves the second Pantheon site to the end of the main URL, for example: http://www.example-site.com/blog/