-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
fix(proxy-cache): set Header Accept-Encoding
as default values of vary_headers
#12867
base: master
Are you sure you want to change the base?
Conversation
|
…ary_headers Currently, proxy-cache might mix the compression and uncompression values while cacheing, and return runexpected compression response to the request if users didn't specify the vary_headers.
1e60671
to
07dcb59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I will add a changelog for this and approve the PR after it passes the tests
@chronolaw @oowl could you help to take a look at this PR? |
@@ -72,6 +72,7 @@ return { | |||
elements = { type = "string" }, | |||
}}, | |||
{ vary_headers = { description = "Relevant headers considered for the cache key. If undefined, none of the headers are taken into consideration.", type = "array", | |||
default = { "Accept-Encoding" }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that have introduced breaking change. I am not sure if it is safe for our old version user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @dndx Can you help us to check it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review. Guess it shouldn't be regarded as a breaking change since it only affects how the cache key is calculated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't consider fixing a broken behavior a breaking change. ping @dndx
I did not think it through when I wrote the original comment. The RFC says:
So it's a must to support I found a todo in the plugin's implementation: kong/kong/plugins/proxy-cache/handler.lua Line 435 in 7dd29d4
It's better to fix the issue here. Plus this PR could still be useful. If an upstream does not make use of the Also, it's noteworthy that |
@StarlightIbuki So do you suggest adding the |
We need to add content from the |
@StarlightIbuki Thanks for the clarification. I misunderstood your point. I'll make sure to recapture your point and help to correct me if I'm wrong.
That said if we have the config.vary_headers = {"A"} and the upstream server sends two responses with By the way, I'm not sure if it's good to add this in another PR to make the context more clear? I'm also happy to do that. |
Thanks for offering help. Perhaps a dedicated PR for Vary header support is good. Note we also need to make sure there are no duplicated headers. |
Sure, thanks for your reply. I will take care of this condition. I won't submit an issue to track this enhancement since Kong's issue is only for bug reports. BTW, I'm not sure how to push this PR forward to reviewing. To see if any maintainers can help. |
Please understand that we want the changes to Kong to align with the roadmap and the overall design, and it takes time to decide the solution. This PR particularly needs no more effort from your side and I will try to get some attention for this topic. |
Internally tracked: KAG-4292 |
@StarlightIbuki That's great, thanks a lot for your help. |
Hi @StarlightIbuki, want to know if this fix discussion has any progress? |
I checked the ticket (KAG-4292), it seems that there are still some discussions on it, no decision is out. |
Summary
Currently, proxy-cache might mix the compression and uncompression values while caching, and return unexpected compression response to the request if users didn't specify the vary_headers.
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
Fix #12796