I spoke to some people of fastly.com at the 6th Varnish User Group Meeting. It should be just a few lines of code to support purge requets on the fastly.com cdn.

Comments

Leon Kessler’s picture

Issue summary: View changes

Not sure what has changed (with the Fastly API) since 2012, but I've got the purge module working with Fastly.

The only issue I had, was Fastly not liking the host header being sent with the requests (as I was purging from a different host than the Fastly proxy host, so I guess Fastly was rejecting it).
I had to remove the header by using patch from #1888866: Allow other modules to add hostnames and headers for purge requests and implementing hook_purge_requests_alter() in a custom module.

Leon Kessler’s picture

Here's the hook implementation incase anyone is interested:

/**
 * Implements hook_purge_requests_alter().
 *
 * Remove the Host header as this is causing purge requests to fail with Fastly.
 * NOTE: this relies on the purge module being patched from
 * https://www.drupal.org/node/1888866
 */
function mymodule_purge_requests_alter(&$purge_requests) {
  foreach ($purge_requests as $key => $purge) {
    foreach ($purge['headers'] as $header_key => $header) {
      if (drupal_substr($header, 0, 4) == 'Host') {
        unset($purge_requests[$key]['headers'][$header_key]);
      }
    }
  }
}
Elijah Lynn’s picture