-
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
feat(proxy-cache): add ignore_uri_case to configuring cache-key uri to be handled as lowercase #10453
feat(proxy-cache): add ignore_uri_case to configuring cache-key uri to be handled as lowercase #10453
Conversation
hi @tobiasehlert ,add test case in #10466 |
@sabertobihwy should I close this PR? Your PR good good 👌 |
Hey @sabertobihwy, thank you for your PR. Could you please close it? We want contributors to work through the PR process and get to the finish line of merge. We wish to give everyone an opportunity to submit a clean and complete patch. If the PRs stall, then we can take someone's contribution and build on top of it (provided they have signed the CLA and we give them due credit). @tobiasehlert Could you please write a test for this? |
OK, I'll close my PR. i just want to help @tobiasehlert write a test case. But I don't have permission to update it on his PR. So let's work together on this PR. |
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.
Looks good, just a couple of small suggestions
Note: the |
Co-Authored-By: sabertobihwy <71637422+sabertobihwy@users.noreply.github.com>
Co-authored-by: Samuele Illuminati <samuele@konghq.com>
to check cache-key when ignore_uri_case is set to false
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.
One more thing @tobiasehlert, to keep compatibility with hybrid mode we need to add the new configuration parameter to the removed_fields
for dataplanes older than 3.3.0, essentially adding this bit:
proxy_cache = {
"ignore_uri_case",
}
in this section:
kong/kong/clustering/compat/removed_fields.lua
Lines 59 to 63 in f62b329
[3003000000] = { | |
acme = { | |
"account_key", | |
} | |
}, |
for compability in hybrid mode
Sound important to add! I did that in 402f3e8 now :) |
@samugi seems like something faulty in the second test.. https://github.com/Kong/kong/actions/runs/4425523590/jobs/7760716719#step:9:711 You have a clue why it complains on line 1435? :| |
should be good now @tobiasehlert |
Awesome, thanks for the support @samugi 🥇 |
thank you for your contribution @tobiasehlert !! |
Summary
The proxy-cache plugin uri input is taken straight from
ngx.var.request
and when incoming requests are randomized with lowercase and uppercase letters, all requests are handled as new ones.The issue with this is that the proxy-cache sees then as unique requests, even if the backend request response is exactly the same and the cache-key should therefore be possible to set to lowercase that upstream servers are not receiving unnecessary requests.
Example of requests being randomized and handled as unique cache entries:
/api/greeting/tobias
/api/greeting/Tobias
/api/greeting/tObIaS
Default of the
ignore_uri_case
isfalse
and the cache-key will be based on the actualngx.var.request
, but when setting the parameter totrue
instead, it will be lowercased instead.Checklist
Full changelog
ignore_uri_case
for the proxy-cache plugin to lowercase the request and use that for cache-key calculation.Discussion reference
Rel #7821 & #10425