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.
Connect Fastly to Pantheon
Follow the steps below to connect your Fastly account to your Pantheon account.
Sign in to your Fastly account.
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
.
- Sub-domain information can be found under the Domains/SSL tab. It should look similar to:
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 assite-example.com
. You must usewww
. Your site domain should look like this:www.site-example.com
.
- Note that Fastly does not serve
Click Configure after Fastly has finished setting up the service.
Click the Hosts tab, select the + New button, and then add the Pantheon sub-domain for the secondary site's Live environment.
Select the gear icon next to the primary content host, then select Conditions.
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.
- This tells Fastly that any URL that contains
Select the gear icon next to the secondary content host, and then select Conditions.
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.
- This tells Fastly that any URL that contains
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
- Name:
Click Create and save the new content.
Click the gear icon next to the Main_Server_Host header, and then select Request Conditions.
Click the Name drop-down menu, select the
Main_Server_Host_Condition
, and then click Assign.- This assigns the
Main_Server_Host
Header to theMain_Server_Host_Condition
and appends the header to all traffic sent to the main content server on Pantheon.
- This assigns the
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
- Name:
Click Create and save the new content.
Click the gear icon next to the
Main_Server_Host
header, and then select Request Conditions.Click the Name drop-down menu, select
Blog_Server_Host_Condition
, and then click Assign.- This assigns the
Main_Server_Host
Header to theBlog_Server_Host_Condition
and appends the header to all traffic sent to the main content server on Pantheon.
- This assigns the
Test Your Setup
Follow the steps below to confirm that your Fastly account is working correctly with your Pantheon account.
Open a new browser tab and load the main URL, for example:
http://www.example-site.com/
.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/