-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f54d89
commit e9f3b59
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
.. _fastly configuration: | ||
|
||
Fastly Configuration | ||
------------------- | ||
|
||
Caching is enabled by default. All requests that are marked as cachable will be cached. | ||
|
||
Tagging | ||
~~~~~~~ | ||
|
||
Fastly supports :term:`tagging` out of the box. | ||
Requests can be tagged using a custom header named ``Surrogate-Keys``. | ||
|
||
Purge | ||
~~~~~ | ||
|
||
Fastly supports two types of deletion of cached items using tags: | ||
|
||
1. Soft Purge: This is the default behavior. It will mark the cached item as stale and will serve the stale item until the TTL expires. Once the TTL expires, the stale item will be evicted from the cache and the next request will be fetched from the origin. | ||
2. Purge: This will immediately evict the cached item from the cache and the next request will be fetched from the origin. | ||
|
||
There are different ways to purge the cache: | ||
1. Using Tags | ||
2. Using URLs | ||
|
||
Cache Header | ||
~~~~~~~~~~~~ | ||
|
||
To specify how long items should be cached you can use the ``Surrogate-Control`` header. | ||
Using this header enables you to use the ``Cache-Control`` header to specify the cache duration for browsers. | ||
|
||
Actually this package doesn't support the ``Surrogate-Control`` header. | ||
To configure the ``Cache-Control`` you either have to set ``Surrogate-Control`` yourself or | ||
configure the ``Cache-Control`` header in your fastly configuration. | ||
|
||
.. code-block:: none | ||
set beresp.http.Surrogate-Control = beresp.http.Cache-Control; | ||
// Add your rules here | ||
if (req.url ~ "\.(css|js|jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv|woff|woff2|svg|ico)") { | ||
} else { | ||
set beresp.http.Cache-Control = "no-store, max-age=0"; | ||
} |