The cache-control plug-in can add the Expires and Cache-Control headers to responses based on URL file suffixes. This allows browsers to cache files with specific suffixes, such as jpg and png.
Running attributes
Plug-in execution stage: Authorization. Plug-in execution priority: 200.
Fields
Field | Data type | Required | Default value | Description |
suffix | string | No. The suffix to match, such as To match multiple suffixes, separate suffixes with a vertical bar ( If you do not specify this parameter, all suffixes are matched. | - | This parameter specifies the suffix of files to match. |
expires | string | Yes. The maximum period of time to cache files for. If you specify digits as the value, the unit is seconds. For example, to specify a period of 1 hour, you must enter 3600. epoch and max are supported and carry the same semantics as in nginx. | - | This parameter specifies the maximum period of time to cache files for. |
Configuration examples
Cache files whose suffix is
jpg,png, orjpegfor one hour:suffix: jpg|png|jpeg expires: 3600Based on the preceding configuration, the
ExpiresandCache-Controlheaders will be added to responses to the following requests to cache matched files for one hour:curl http://example.com/test.png curl http://exmaple.com/test.jpgCache all files until
Thu, 31 Dec 2037 23:55:55 GMT:expires: max