Repository navigation
Conversation
|
as i am learning lua for the first time so that is the reason i got late in solving the bug @Baoyuantop sir and looking for feedback also. |
| api_ctx.var.upstream_uri = core.utils.uri_safe_encode(uri) | ||
| -- after ';'. URI-encode it and store separately so $is_args$args can | ||
| -- be appended after rewrite and access plugin phases complete. | ||
| api_ctx.servlet_upstream_uri = core.utils.uri_safe_encode(uri) |
There was a problem hiding this comment.
Early plugins lose servlet path parameters
With servlet normalization enabled, upstream_uri stays empty during rewrite and access plugins. The external pre-request runner sees a stripped path, and GraphQL introspection can target a different endpoint than the forwarded request.
Example: For /anything;jsessionid=x, the pre-request runner now receives /anything; the upstream receives /anything;jsessionid=x. A GraphQL endpoint available only at the latter path fails schema discovery at the former path.
…vlet URI normalization Fixes apache#13983
10d3107 to
c1fd74f
Compare
|
Hi @Baoyuantop,looking for another feedback! I've updated the PR so that I also added a regression test in |
|
Hi @Baoyuantop sir can you look a minute for my pr it will be really great if you provide some feedback |
Description
Background & Problem:
When
apisix.normalize_uri_like_servletis enabled,$upstream_uriwas materialized before routerewriteandaccessplugins executed.Some plugins modify the request arguments dynamically during these later phases. For example,
key-authandjwt-authremove query credentials viacore.request.set_uri_args()whenhide_credentials: trueis configured. Because$upstream_urialready contained a snapshot of the earlier query string, those query modifications were not reflected in the URI forwarded upstream, causing credentials to leak and query argument changes to be lost.Solution:
api_ctx.servlet_upstream_uriinstead of eagerly writing toapi_ctx.var.upstream_uri.$upstream_uriwith the updated$is_args$argsafter therewriteandaccessplugin phases have completed.proxy-rewriteexplicitly setsapi_ctx.var.upstream_uri, do not overwrite it.proxy-mirrorto also respectservlet_upstream_uri.t/router/servlet-upstream-uri.tcovering:apisix.normalize_uri_like_servlet: truekey-authwithhide_credentials: true?when all arguments are stripped.Which issue(s) this PR fixes:
Fixes #13983
Checklist