Skip to content
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-rewrite): create use_real_request_uri_unsafe option #7401

Merged
merged 13 commits into from
Jul 19, 2022

Conversation

ilteriseroglu-ty
Copy link
Contributor

Description

This PR fixes #7386.

As per the linked issue:

During our tests we have noticed that APISIX always uses the normalized/decoded URI coming from nginx (as per its design, which isn't an issue), and this creates an edge case where a backend that requires URL Encoded URIs to not work properly (i.e. GitLab API calls that reference paths inside a project use %2F instead of /).

This PR implements an option named use_real_request_uri_unsafe to utilize real_request_uri (which is originally request_uri in nginx; its the request uri that's not normalized) and bypass all encoding calls inside.

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

@spacewander spacewander marked this pull request as ready for review July 7, 2022 09:40
@spacewander spacewander marked this pull request as draft July 7, 2022 09:40
@spacewander
Copy link
Member

Sorry for hitting the Ready for review button by accident

@ilteriseroglu-ty ilteriseroglu-ty marked this pull request as ready for review July 7, 2022 10:30
@ilteriseroglu-ty
Copy link
Contributor Author

The failed CI test had issues accessing GitHub so I'm marking the PR as ready

Copy link
Contributor

@tokers tokers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

docs/en/latest/plugins/proxy-rewrite.md Outdated Show resolved Hide resolved
t/lib/server.lua Outdated Show resolved Hide resolved
t/plugin/proxy-rewrite3.t Outdated Show resolved Hide resolved
apisix/plugins/proxy-rewrite.lua Outdated Show resolved Hide resolved
t/plugin/proxy-rewrite3.t Outdated Show resolved Hide resolved
Signed-off-by: İlteriş Yağıztegin Eroğlu <ilteris.eroglu@trendyol.com>
Signed-off-by: İlteriş Yağıztegin Eroğlu <ilteris.eroglu@trendyol.com>
…_uri_unsafe

Signed-off-by: İlteriş Yağıztegin Eroğlu <ilteris.eroglu@trendyol.com>
Signed-off-by: İlteriş Yağıztegin Eroğlu <ilteris.eroglu@trendyol.com>
@ilteriseroglu-ty
Copy link
Contributor Author

I'm not quite sure why CLI Test / build (ubuntu-18.04, linux_apisix_current_luarocks_in_customed_nginx) (pull_request) test fails

docs/en/latest/plugins/proxy-rewrite.md Outdated Show resolved Hide resolved
t/plugin/proxy-rewrite3.t Outdated Show resolved Hide resolved
@juzhiyuan juzhiyuan requested a review from tokers July 19, 2022 01:11
@spacewander spacewander merged commit ccd70df into apache:master Jul 19, 2022
@ilteriseroglu-ty ilteriseroglu-ty deleted the feat-proxy-rewrite-unsafe branch July 19, 2022 11:10
Liu-Junlin pushed a commit to Liu-Junlin/apisix that referenced this pull request Nov 4, 2022
ilteriseroglu-ty added a commit to ilteriseroglu-ty/apisix that referenced this pull request Dec 23, 2022
This commit fixes a bug where ctx.var.upstream_uri is
not set when use_real_request_uri_unsafe is enabled.

It seems that somewhere in the runtime chain (LuaJIT?)
a memory jump occurs and ctx.var.upstream_uri _does_ get set
even though it definitely **shouldn't**. Hence why this got unnoticed
in the CI tests of apache#7401.

Signed-off-by: İlteriş Yağıztegin Eroğlu <ilteris.eroglu@trendyol.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Expose an option for (real_)request_uri to be used in proxy-rewrite plugin
5 participants