update plugins doc (#1305)

This commit is contained in:
澄潭
2024-09-12 21:48:40 +08:00
committed by GitHub
parent 0f9113ed82
commit c7c4ae1da2
80 changed files with 7373 additions and 2368 deletions

View File

@@ -1,14 +1,25 @@
# 功能说明
---
title: 浏览器缓存控制
keywords: [higress,浏览器缓存控制]
description: 浏览器缓存控制插件配置参考
---
## 功能说明
`cache-control`插件实现了基于 URL 文件后缀来为请求的响应头部添加 `Expires``Cache-Control` 头部,从而方便浏览器对特定后缀的文件进行缓存,例如 `jpg``png` 等图片文件。
# 配置字段
## 运行属性
插件执行阶段:`认证阶段`
插件执行优先级:`420`
## 配置字段
| 名称 | 数据类型 | 填写要求 | 默认值 | 描述 |
|---------|--------|-----------------------------------------------------------------------------------------------------|-|--------------------------|
| suffix | string | 选填,表示匹配的文件后缀名,例如 `jpg``png` 等。<br/>如果需要匹配多种后缀,需要用 `\|` 进行分割,例如 `png\|jpg`。<br/>如果不填写,表示匹配所有后缀 | - | 配置用于匹配的请求文件后缀 |
| expires | string | 必填,表示缓存的最长时间。<br/>当填入的字符串为数字时单位为秒例如需要缓存1小时需填写 3600。<br/>另外,还可以填写 epoch 或 max<br/>,与 nginx 中语义相同。 | - | 配置缓存的最大时间 |
# 配置示例
## 配置示例
1. 缓存后缀为 `jpg`, `png`, `jpeg` 的文件,缓存时间为一小时
```yaml
suffix: jpg|png|jpeg

View File

@@ -0,0 +1,33 @@
---
title: Browser Cache Control
keywords: [higress, browser cache control]
description: 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.<br/>If multiple extensions are needed, separate them with `\|`, for example `png\|jpg`.<br/>If not specified, it matches all extensions. | - | Configures the request file extensions to match |
| expires | string | Required, indicates the maximum caching time.<br/>When the input string is a number, the unit is seconds; for example, if you want to cache for 1 hour, enter 3600.<br/>You can also enter epoch or max<br/>, 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
```yaml
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.
```bash
curl http://example.com/test.png
curl http://example.com/test.jpg
```
2. Cache all files, with a maximum caching time of `"Thu, 31 Dec 2037 23:55:55 GMT"`
```yaml
expires: max
```