Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: tzssangglass <[email protected]>
  • Loading branch information
Gary-Airwallex and tzssangglass authored Mar 11, 2022
1 parent 5848bb4 commit d29e7d9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/zh/latest/plugins/cors.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ title: cors
| max_age | integer | 可选 | 5 | | 浏览器缓存 CORS 结果的最大时间,单位为秒,在这个时间范围内浏览器会复用上一次的检查结果,`-1` 表示不缓存。请注意各个浏览器允许的最大时间不同,详情请参考 [MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age#Directives)|
| allow_credential | boolean | 可选 | false | | 是否允许跨域访问的请求方携带凭据(如 Cookie 等)。根据 CORS 规范,如果设置该选项为 `true`,那么将不能在其他选项中使用 `*`|
| allow_origins_by_regex | array | 可选 | nil | | 使用正则表达式数组来匹配允许跨域访问的 Origin,如[".*\.test.com"] 可以匹配任何test.com的子域名`*`|
| allow_origins_by_metadata | array | 可选 | nil | | 通过引用插件元数据的`allow_origins`配置允许跨域访问的Origin. 比如当元数据为`"allow_origins": {"EXAMPLE": "https://example.com"}`时,配置`["EXAMPLE"]`将允许Origin`https://example.com`的访问 |
| allow_origins_by_metadata | array | 可选 | nil | | 通过引用插件元数据的 `allow_origins` 配置允许跨域访问的
Origin。比如当元数据为 `"allow_origins": {"EXAMPLE": "https://example.com"}` 时,配置 `["EXAMPLE"]` 将允许 Origin `https://example.com` 的访问 |

> **提示**
>
Expand All @@ -47,7 +48,7 @@ title: cors

| 名称 | 类型 | 必选项 | 默认值 | 有效值 | 描述 |
| ----------- | ------ | ------ | ----- | ----- | ------------------ |
| allow_origins | object | 可选 | | | 定义允许跨域访问的Origin; 它的键为`allow_origins_by_metadata`使用的引用键, 值则为允许跨域访问的Origin,其语义与`allow_origins`相同 |
| allow_origins | object | 可选 | | | 定义允许跨域访问的 Origin;它的键为 `allow_origins_by_metadata` 使用的引用键, 值则为允许跨域访问的 Origin,其语义与 `allow_origins` 相同 |

## 如何启用

Expand Down

0 comments on commit d29e7d9

Please sign in to comment.