Add GeoIP data about the client browser as extra headers in any requests from Fastly to your origin.
Solution recipes for video
Our recipe library is an always-evolving set of code samples to do just about anything on the Fastly edge cloud. Have a browse or search for a keyword to find the perfect, ready-made solution you can paste into your service or adapt and customize for your own needs. Using Fastly Fiddle, play with any recipe and take advantage of the Fastly edge cloud, all without registering or affecting any existing account.
Set TTLs at the edge based on the type of resource. Better done at origin, but this can be a great 'quick fix' or a solution if you don't control the origin.
Try backends in turn until one is healthy (also known as an 'active-standby' strategy)
Range headers sent from client are stripped by Fastly so we can cache the full object at the edge.
Make URLs expire after a configurable period.
Improve cache performance by normalizing requests. Filter and reorder query params, convert to lowercase, filter headers, and more.
Use Fastly's support for ESI to combine multiple origin-hosted objects into a single response at the edge.
Protect clients from redirects by chasing them internally at the edge, and then return the eventual non-redirect response.
Use the new Sec-Fetch-Dest header or URL patterns to identify assets that should not allow querystrings to be part of the cache key.
Group countries to cache content by custom regions or reject requests from some regions entirely.
Fastly offers a myriad of different variables that you can log. See and test a large collection here.
Avoid a huge inrush of traffic to origin caused by gradually applying changes that affect the cache key, like segmented caching, over hours or days.
Shielding directs requests through two Fastly datacenters instead of one, improving cache hit ratio and reducing traffic to your origin.
Combine multiple source images into a single image and then optimize and serve the result.
All code on this page is provided under both the BSD and MIT open source licenses.