Hear from Slack, the ACLU, TED, & more at our customer summit in San Francisco Register
LOG IN SIGN UP
Documentation

Purging optimized images

  Last updated April 18, 2017

Instant Purging removes an image from Fastly caches immediately so it can be refreshed from your origin servers.

To purge images using key-based purging, determine the appropriate purge key to use and then follow one of the key-based purging methods below.

Determining the appropriate purge key

The purge key represents the path of your origin image without the Fastly Image Optimizer query string URL API parameters. For example, if the image URL is http://www.fastly.io/image.jpg?width=205, then the purge key is http://www.fastly.io/image.jpg.

If your origin image requires adding origin query string parameters to the request these must be included in the purge key also. For example, if the image URL with parameters is http://www.fastly.io/image.jpg?width=205&origin-token=foo, then the purge key is http://www.fastly.io/image.jpg?origin-token=foo.

Purging an image via the user interface

  1. Log in to the Fastly web interface and click the Configure link.
  2. From the service menu, select the appropriate service.
  3. From the Purge menu, select Purge Key. The Purge Key window appears.

    a purge by url

  4. In the Key field, type the path to the origin image plus any origin query string parameters that may require being passed to the Fastly Image Optimizer.
  5. In the Password field, type your Fastly password.
  6. Click the Purge button.

Purging an image via API

The syntax for purging a service through the API can be found in the Purging section of the API documentation. For example:

curl -H "Fastly-Key: FASTLY_API_TOKEN" -X POST https://api.fastly.com/service/SERVICE-ID/purge/PURGE-KEY

Soft Purging an image via API

Soft Purging sets an object's TTL to 0s, forcing revalidation. For best results, Soft Purging should be used in conjunction with stale_while_revalidate and stale_if_error. For example:

curl -H "Fastly-Key: FASTLY_API_TOKEN" -H "Fastly-Soft-Purge: 1" -X POST https://api.fastly.com/service/SERVICE-ID/purge/PURGE-KEY

This article describes a product that may use third-party cloud infrastructure to process or store content or requests for content. For more information, see our cloud infrastructure security and compliance program.

Back to Top