Magento Cloud

Fastly CDN is available in staging and production environments.

To setup traffic split using Fastly, please ensure you are using the latest Fastly CDN for Magento module and verify that Fastly CDN is properly configured following the official documentation.

1

Access Fastly Configuration

Login to your Magento admin and navigate to Stores > Configuration > Advanced > System > Full Page Cache > Fastly Configuration

2

Create Glopal backend

Expand the Backend Settings and click the [Create] button

3

Define a condition

Click the [Attach a condition] and select [Create a new request condition]

Set name to “Glopal Origin” and enter req.http.X-GlopalOrigin == "1" as the "Apply if expression" in the textbox. Click the [Create] button to save the condition.

4

Complete backend configuration

Set backend name to “Glopal Origin” and enter the address as provided by Glopal. Ensure shielding remains set as (none).

5

Create two new VCL snippets

Under Custom VCL Snippets create two new VCL snippets.

Make sure to replace GLOPAL_HOSTNAME and GLOPAL_SECRET placeholders with the value you receive from Glopal and that PATTERN is a regular expression describing list of in-scope paths you want to delegate to Glopal.

vcl_recv snippet

Name: Glopal recv Type: recv Priority: 100

if ( req.restarts == 0 ) {
   remove req.http.X-GlopalOrigin;
}

# Forward target to Glopal
if ( req.url.path ~ "^/()($|[:/?])" ) {
   set req.http.X-GlopalOrigin = "1";
   set req.http.X-Forwarded-Host = req.http.Host;
}

# Whitelist when Glopal is fetching source
if ( req.http.X-Glopal == "" ) {
   set req.http.x-sigsci-no-inspection = "disabled";
}

vcl_backend_fetch snippet

Name: Glopal backend_fetch Type: backend_fetch Priority: 100

if ( bereq.http.X-GlopalOrigin ) {
  set bereq.http.Host = "";
  unset bereq.http.X-GlopalOrigin;
}
6

Upload configuration

Back under Fastly Configuration, click the [Upload VCL to Fastly] button.

Documentation reference

Last updated