All Products
Search
Document Center

API Gateway:cache-control

Last Updated:Jun 17, 2026

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 jpg and png.

To match multiple suffixes, separate them with a vertical bar (|). Example: png|jpg.

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 epoch and max are also supported,

with the same semantics as in nginx.

-

The maximum cache duration for matched files.

Configuration examples

  1. Cache files with the suffix jpg, png, or jpeg for one hour:

    suffix: jpg|png|jpeg
    expires: 3600

    With this configuration, Expires and Cache-Control headers 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
  2. Cache all files until Thu, 31 Dec 2037 23:55:55 GMT:

    expires: max