Information for: DEVELOPERS   PARTNERS

Cloud Platform CDN

This documentation page describes features and procedures for a beta product, and its contents may change at any time. Acquia does not recommend bookmarking this page as its location may change without notice.
This feature is available only for eligible Cloud Platform Enterprise subscribers. For more information, contact your Account Manager.

Using the Cloud Platform CDN, you can deliver accelerated digital experiences to global audiences by caching pages and static assets (including JavaScript, CSS, and images) at over 65 points of presence (POPs) around the world. Visitors accessing your website will load the static assets from the POP closest to their location, which decreases the amount of time required to load a page, and can lead to increased conversions.

Acquia configures and manages the Cloud Platform CDN so you don’t have to. Based on years of experience accelerating Drupal applications through Varnish®, Acquia has configured the Cloud Platform CDN to optimize the delivery of digital experiences built with Drupal.

Setting up Cloud Platform CDN

To enable the Cloud Platform CDN for your subscription, complete the following steps:

  1. Contact your Account Manager to start the activation process. Provide information about the following resources for which you want to enable access:

    • Applications
    • Environments
    • Domain names
  2. After activation, Acquia provides both the Cloud Platform CDN IP address and hostname, and added code for use with the Drupal 8+ version of the Acquia Purge module.

  3. Complete the following steps depending on whether you’re using Drupal 7 or any version since Drupal 8.

    1. Install and enable the Acquia Purge module. Be sure to incorporate the provided, updated Acquia Purge module code into your website’s codebase.
    2. Sign in to your Drupal website as an administrator, and then enable the acquia_cdn_purge module.
    3. Navigate to Configuration > Development > Performance > Purge to review the Purge module status. To the right, Status displays Platform CDN which should be green. If it displays red, contact Acquia Support.

    Install and enable the Acquia Purge module, but only enable the Cloud Platform purger. The Acquia Purge module will keep the Drupal and Varnish caches in sync. For more information, see the Acquia Knowlege Base article Acquia Purge FAQ for Drupal 7.

  4. Configure your authoritative DNS to route traffic to your domains through Acquia’s Cloud Platform CDN using the following endpoints:

    • For domains that support CNAME records, configure them to point to acquia.map.fastly.net.
    • For other domains that can’t use a CNAME record, configure at least two A RECORDS pointing to 151.101.1.193, 151.101.65.193, 151.101.129.193, or 151.101.193.193.

SSL certificates and Cloud Platform CDN

Cloud Platform Enterprise supports SSL certificates on both the Cloud Platform CDN and on Cloud Platform balancers, enabling you to deliver fully secure experiences for your visitors. If you want to deploy your SSL certificate on Cloud Platform CDN, contact Acquia Support for assistance.

Note

Ensure your certificates use a 2048-bit private key before enabling the Cloud Platform CDN. Only certificates created with a 2048-bit private key can be used with Acquia’s Platform CDN.

Maintaining cache consistency

The Cloud Platform CDN fully respects both HTTP Cache-Control headers and tag-based invalidation, which was first introduced in Drupal 8. Acquia recommends continuing to use both methods as part of your application’s caching strategy.

Configure the Drupal 7 cache-control headers

As Drupal 7 doesn’t support tag-based invalidation by default, Acquia recommends setting Drupal’s maximum time for keeping cached assets to 60 minutes. This allows assets to remain efficiently cached for a moderate amount of time before updates are fetched from Drupal. This value can be configured downwards as needed to ensure your visitors receive up-to-date content.

To configure the maximum time, from your website’s administrative menu:

  1. Go to Configuration > Development > Performance.

  2. Enable caching for anonymous users and set Expiration of cached pages to the duration you require.

    Caching and performance settings

The settings displayed in the image will generate the following HTTP headers:

Cache-Control: public, max-age=3600

Public means the response may be stored by all caches, including Varnish, the Platform CDN, and browser caches.

Purging the Platform CDN cache

You can manually purge the Platform CDN cache using the curl command. To do this complete the following steps:

  1. Run the following grep command to locate the API ID and secret in the settings.inc file:

    grep -A 10 acquia_service_credentials /var/www/site-php/sitename/*settings.inc
    

    The output will appear similar to the following:

    D8-sitename-common-settings.inc:$settings['acquia_service_credentials'] = array (
    D8-sitename-common-settings.inc-  'platform_cdn' =>
    D8-sitename-common-settings.inc-  array (
    D8-sitename-common-settings.inc-    'vendor' => 'fastly',
    D8-sitename-common-settings.inc-    'configuration' =>
    D8-sitename-common-settings.inc-    array (
    D8-sitename-common-settings.inc-      'service_id' => '4SsvFsxK25Z7t16kTqzu7d',
    D8-sitename-common-settings.inc-      'token' => 'DMDf1ryoZiERdryIxQAb4seLOBqLfLMU',
    D8-sitename-common-settings.inc-    ),
    D8-sitename-common-settings.inc-  ),
    D8-sitename-common-settings.inc-);
    
  2. Purge the Platform CDN by running the following curl command with the token in the header and the service_id in the URL path as shown in the following example:

    curl -X POST -H "Fastly-Key:DMDf1ryoZiERdryIxQAb4seLOBqLfLMU" -H "Accept: application/json" https://api.fastly.com/service/4SsvFsxK25Z7t16kTqzu7d/purge_all
    

Drupal 8 and Drupal 9 support tag-based cache invalidation by default. The Platform CDN along with the Acquia Purge and acquia_cdn_purge modules make full use of it. For more information, see the Acquia Knowledge Base article Acquia Purge & cache tags invalidation. Any edits you make to content will cause only that content to be purged from all the caches, including the Platform CDN cache.

If you need to purge all content from all caches, then use Drupal’s Clear All Caches option which also clears the Platform CDN cache.

Drupal 7 doesn’t support tag-based invalidation by default. If you need your website to reflect a particular edit before cached content expires, you can trigger a full purge of the Platform CDN cache through the following curl command:

curl -X POST -H "Fastly-Key:<Platform CDN API Key>" -H "Accept: application/json" https://api.fastly.com/service/<Platform CDN Service ID>/purge_all

Use the API Key and Service ID values provided to you by Acquia.

Before manually purging the Platform CDN cache, purge your Varnish cache to ensure cache consistency.

Cloud Platform CDN provisioning schedule

The Cloud Platform CDN provisioning request schedule is as follows:

SSL certificate updates are subject to the same timeline as the overall provisioning process and will be carried out once per week.

Cloud Platform CDN requests must include:

  • A list of all custom domains that should be provisioned for use on the Cloud Platform CDN.

    Note

    • Before provisioning, subscribers must configure all websites for use on Cloud Platform.
    • Default acquia-sites.com domains are not eligible for use on the Cloud Platform CDN.
    • Bare domains and www subdomains must be listed individually.
  • All custom domains that will use SSL must have valid SSL certificates uploaded and active in Cloud Platform.

Troubleshooting

Cloud Platform CDN may not provision for any of the following reasons:

No domains registered to environment (except acquia-sites.com): The default *.acquia-sites.com domain cannot be added to the CDN. You must add at least one of your own domains before Platform CDN can be provisioned.

Your domain was previously registered with Acquia’s CDN partner, Fastly Inc.: If you or your agency created a Fastly account in the past using one of your domain names then contact Acquia support. Acquia support will work with Fastly to free up the domain for use on Platform CDN.

Old certificate is being served instead of the newly uploaded certificate: This can happen if your new certificate has a wildcard domain and the old certificate has a different wild card or an exact match. Platform CDN will serve a valid certificate with the most-matching CN or SAN. De-active the old certificate via Acquia Cloud UI or contact Acquia support for assistance.

HTTP to HTTPS redirect gets stuck in a 301 redirect loop: Purge all caches. If the problem persists please contact Acquia support.

SSO redirects browser to not-logged-in content: Ensure your application is serving a Cache-Control header with value max-age:3 or must-revalidate so that the browser does not use its local cache.

Purge token lost or doesn’t work: A lost token can be recovered. See Purging the Platform CDN cache. If your token doesn’t allow purging objects from Platform CDN, contact Acquia support.

The acquia-purge module is not working correctly: Use Drush 9 to run drush p:dia. If that command is not available, use the following method to ensure that all the modules are installed and enabled:

# in your local dev environment
git clone [email protected]:manualtest.git
cd manualtest/docroot

# Use composer to install acquia_purge 1.1 beta and its dependencies
composer config minimum-stability 'beta'
composer config prefer-stable true
composer require 'drupal/acquia_purge:1.1-beta1'

# Push the code back and enable the module using drush
git add.
git commit -a -m "Add Acquia Purge module"
git push
ssh {{YOUR SSH URI HERE}}
sudo su
cd /var/www/html/{{YOUR ENVIRONMENT NAME HERE}}/docroot/
source /mnt/users/[SITEGROUP NAME]/dev.shell
drush9 en acquia_purge
yes
#>>  [success] Successfully enabled: acquia_purge, purge, purge_drush

# list all the available purgers
drush9 p:purger-lsa
#>> --------------------- ---------------------------- ----------------------------------------------
#>> Plugin                Label                        Description
#>> --------------------- ---------------------------- ----------------------------------------------
#>> acquia_purge          Acquia Cloud                 Invalidate content from Acquia Cloud.
#>> acquia_platform_cdn   Acquia Platform CDN (beta)   Invalidate content from Acquia Platform CDN.
#>> --------------------- ---------------------------- ----------------------------------------------

# Enable the acquia purge and then the acquia_platform_cdn in that order to ensure
# varnish clears first and then platform_cdn clears after a short delay
drush9 p:purger-add acquia_purge
drush9 p:purger-add acquia_platform_cdn

# Enable the other purge modules that need manually enabled for some reason
drush9 pm:list | grep purge
drush9 en purge_processor_cron
drush9 en purge_processor_lateruntime
drush9 en purge_queuer_coretags
drush9 en purge_tokens
drush9 en purge_ui
drush9 en purge_drush
drush9 pm:list | grep purge

# Run the diagnostic
drush9 p:dia