-
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
hotfix(router) allow url escaped uris #2377
Conversation
a8d64d3
to
1d85424
Compare
kong/core/router.lua
Outdated
else | ||
local s = find(uri, "?", 2, true) | ||
if s then | ||
uri = sub(uri, 1, s - 1) |
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.
We need to strip the uri
prior to the find_api
call. The reason is that as this stands now, we would greatly increase the risk of cache miss because the same URL path may have different querystring parameters, hence resulting in a different cache key.
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.
As a side note, it may be worth it to introduce unit tests that ensure the cache is hit when appropriate in the future. Part of a future improvement we can do to ensure the stability of such a critical component :)
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.
Uh, good catch indeed. Sorry for this screw up :-)
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.
The fix is done and pushed, I need to add the cache hit / miss
tests still.
Change the router to use `ngx.var.request_uri` instead of the normalized `ngx.var.uri`. Makes proxying more transparent. Fixes #2366
7292b55
to
29f81cb
Compare
Merged with minor modifications, thanks! |
Summary
Change the router to use
ngx.var.request_uri
instead of the normalizedngx.var.uri
. Makes proxying more transparent.Issues resolved
Fix #2366