Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(proxy-cache): add wildcard and parameter match support for content_type #5420

Merged
merged 3 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions app/_hub/kong-inc/proxy-cache-advanced/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,32 @@ params:
datatype: array of string elements
description: |
Downstream request methods considered cacheable. Available options: `HEAD`, `GET`, `POST`, `PATCH`, `PUT`.
- name: content_type
required: true
default: 'text/plain, application/json'
- name: content_type # old version of param
maximum_version: "3.2.x"
required: null
default: '`["text/plain", "application/json"]`'
value_in_examples:
- text/plain
- application/json
datatype: array of string elements
description: |
Upstream response content types considered cacheable. The plugin performs an **exact match** against each specified value; for example, if the upstream is expected to respond with a `application/json; charset=utf-8` content-type, the plugin configuration must contain said value or a `Bypass` cache status is returned.
- name: content_type # current version of param
minimum_version: "3.3.x"
required: null
default: '`["text/plain", "application/json"]`'
value_in_examples:
- text/plain
- application/json
datatype: array of string elements
description: |
Upstream response content types considered cacheable.

The wildcard content type can be used to match any specific type or subtype.
For example, `application/*` matches any subtypes of the application, `*/*` matches all content types.

Note that `*/*` does not match with a content type that contains a parameter (e.g. `*/*` would not match `application/json; charset=utf-8`).
If the response content type does not match the configuration, a `Bypass` cache status is returned.
- name: vary_headers
required: false
default: null
Expand Down Expand Up @@ -448,6 +465,7 @@ Note that this endpoint purges all cache entities across all `proxy-cache-advanc

**{{site.base_gateway}} 3.3.x**
* Added the `ignore_uri_case` configuration parameter.
* Added wildcard and parameter match support for `config.content_type`.

**{{site.base_gateway}} 3.1.x**
* Added support for integrating with redis clusters using the `config.redis.cluster_addresses` configuration parameter.
Expand Down
26 changes: 25 additions & 1 deletion app/_hub/kong-inc/proxy-cache/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ params:
datatype: array of string elements
description: |
Downstream request methods considered cacheable.
- name: content_type
- name: content_type # old version of param
maximum_version: "3.2.x"
required: null
default: '`["text/plain", "application/json"]`'
value_in_examples:
Expand All @@ -59,6 +60,22 @@ params:
datatype: array of string elements
description: |
Upstream response content types considered cacheable. The plugin performs an **exact match** against each specified value; for example, if the upstream is expected to respond with a `application/json; charset=utf-8` content-type, the plugin configuration must contain said value or a `Bypass` cache status is returned.
- name: content_type # current version of param
minimum_version: "3.3.x"
required: null
default: '`["text/plain", "application/json"]`'
value_in_examples:
- text/plain
- application/json
datatype: array of string elements
description: |
Upstream response content types considered cacheable.

The wildcard content type can be used to match any specific type or subtype.
For example, `application/*` matches any subtypes of the application, `*/*` matches all content types.

Note that `*/*` does not match with a content type that contains a parameter (e.g. `*/*` would not match `application/json; charset=utf-8`).
If the response content type does not match the configuration, a `Bypass` cache status is returned.
- name: vary_headers
required: false
default: null
Expand Down Expand Up @@ -253,3 +270,10 @@ HTTP 204 No Content
```

Note that this endpoint purges all cache entities across all `proxy-cache` plugins.

---

## Changelog

**{{site.base_gateway}} 3.3.x**
* Added wildcard and parameter match support for `config.content_type`.