-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Bug in proxy-cache plugin not returning age header #12787
Comments
Hey @tobiasehlert! Looking at the documentation for proxy-cache plugin you are missing some configuration parameters on the plugin. It seems that if you want the response to have the Age header you need to enable the following configuration: apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: my-cache-1min
namespace: my-api-v4
config:
cache_ttl: 60
content_type:
- text/plain
- application/json
- application/json; charset=utf-8
request_method:
- GET
- HEAD
response_code:
- 200
ignore_uri_case: true
strategy: memory
reponse_headers:
age: true
plugin: proxy-cache Link to the plugin documentation: https://docs.konghq.com/hub/kong-inc/proxy-cache/ Hope this helps, |
hi @joelact and thanks for your reply, but the issue doesn't lie in that. When looking in the configuration of the plugin it says that the You could actually create the KongPlugin resource by only doing this: apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: my-cache-1min
namespace: my-api-v4
config:
strategy: memory
plugin: proxy-cache So yeah.. "required field" flag in the docs doesn't really apply to the KongPlugin part, since the admission webhook (kongplugins.validation.ingress-controller.konghq.com) doesn't actually validate those. Another parameter would be the But this is not the issue in this case.. it's that the Regards, |
@tobiasehlert just tested locally. You are right the Age header is not being returned. I think the schema definition may be the problem. The header does not match the configuration header value. I will try to submit a PR today with a possible fix so the Kong team can review it ASAP. |
The age parameter on the schema was in lower case which caused the header Age to appear only when the kong debug option was enabled. This commit changes the schema parameter from age to Age. Fix Kong#12787
Is there an existing issue for this?
Kong version (
$ kong version
)Kong Enterprise 3.6.1.1
Current Behavior
I have the proxy-cache plugin running (with the response_headers parameters on default) and I do only get back x-cache-status and x-cache-key but not the age header.
By default it should return age and I don't specifically set those values and I also tried to force the age to true but that didn't make any difference.
I checked in both 3.5 (using Kong Gateway in docker) and 3.6.1.1 (using the Kong Gateway Operator in Kubernetes) and it was the same behaviour.
Expected Behavior
I expect a header to be present called age with a number indicating the seconds the request is "old".
Steps To Reproduce
Anything else?
This is my Kubernetes resource:
The text was updated successfully, but these errors were encountered: