Files
higress/plugins/wasm-go/extensions/cache-control
2025-03-26 20:27:53 +08:00
..
2025-03-26 20:27:53 +08:00
2024-09-12 21:48:40 +08:00
2024-09-12 21:48:40 +08:00

title, keywords, description
title keywords description
Browser Cache Control
higress
browser cache control
Browser cache control plugin configuration reference

Function Description

The cache-control plugin implements adding Expires and Cache-Control headers to the response based on the URL file extensions, making it easier for the browser to cache files with specific extensions, such as jpg, png, and other image files.

Runtime Attributes

Plugin execution phase: Authentication Phase
Plugin execution priority: 420

Configuration Fields

Name Data Type Requirements Default Value Description
suffix string Optional, indicates the file extensions to match, such as jpg, png, etc.
If multiple extensions are needed, separate them with |, for example png|jpg.
If not specified, it matches all extensions.
- Configures the request file extensions to match
expires string Required, indicates the maximum caching time.
When the input string is a number, the unit is seconds; for example, if you want to cache for 1 hour, enter 3600.
You can also enter epoch or max
, with the same semantics as in nginx.
- Configures the maximum caching time

Configuration Example

  1. Cache files with extensions jpg, png, jpeg, with a caching time of one hour
suffix: jpg|png|jpeg
expires: 3600

With this configuration, the following requests will have Expires and Cache-Control fields added to the response headers, with an expiration time of 1 hour later.

curl http://example.com/test.png
curl http://example.com/test.jpg
  1. Cache all files, with a maximum caching time of "Thu, 31 Dec 2037 23:55:55 GMT"
expires: max