The cache-control plug-in adds Expires and Cache-Control response headers based on URL file suffixes to enable browser caching for static resources such as jpg and png images.
Running attributes
Execution stage: Authorization. Execution priority: 200.
Fields
|
Field |
Data type |
Required |
Default value |
Description |
|
suffix |
string |
No. The file suffix to match, such as To match multiple suffixes, separate them with a vertical bar ( If not specified, all suffixes are matched. |
- |
The file suffix to match. |
|
expires |
string |
Yes. The maximum cache duration. If you specify a numeric value, the unit is seconds. For example, enter 3600 for one hour. The special values with the same semantics as in nginx. |
- |
The maximum cache duration for matched files. |
Configuration examples
-
Cache files with the suffix
jpg,png, orjpegfor one hour:suffix: jpg|png|jpeg expires: 3600With this configuration,
ExpiresandCache-Controlheaders are added to responses for the following requests, caching matched files for one hour:curl http://example.com/test.png curl http://exmaple.com/test.jpg -
Cache all files until
Thu, 31 Dec 2037 23:55:55 GMT:expires: max