Setting Surrogate-Key headers for Amazon S3 origins

You can mark content with a surrogate key and use it to purge groups of specific URLs at once without purging everything, or purging each URL singularly. On the Amazon S3 side, you can use the x-amz-meta-surrogate-key header to mark your content as you see fit, and then on the Fastly side set up a Header configuration to translate the S3 information into the header we look for.

IMPORTANT

Pay close attention to the capitalization. Amazon S3 only accepts all lowercase header names.

Follow these instructions to set Surrogate-Key headers for Amazon S3 origin servers:

  1. Log in to the Fastly web interface.
  2. From the Home page, select the appropriate service. You can use the search box to search by ID, name, or domain.
  3. Click Edit configuration and then select the option to clone the active version.
  4. Click Content.
  5. Click Create header.

    the Header window with surrogate key info filled in

  6. Fill out the Create a header fields as follows:

    • In the Name field, enter a human-readable name for the header. This name is displayed in the Fastly web interface.
    • From the Type menu, select Cache, and from the Action menu, select Set.
    • In the Destination field, enter http.Surrogate-Key.
    • In the Source field, enter beresp.http.x-amz-meta-surrogate-key.
    • From the Ignore if set menu, select No.
    • In the Priority field, enter 10.
  7. Click Create to create your header.

  8. Click Activate to deploy your configuration changes.
NOTE

There are several limitations to surrogate keys. See the surrogate key limitations section for more information.

Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.