Skip to content

fix: support regex_uri with unsafe_uri in proxy-rewrite#9813

Merged
juststillthinking merged 6 commits into
apache:masterfrom
Revolyssup:revolyssup/fixunsafebug
Jul 14, 2023
Merged

fix: support regex_uri with unsafe_uri in proxy-rewrite#9813
juststillthinking merged 6 commits into
apache:masterfrom
Revolyssup:revolyssup/fixunsafebug

Conversation

@Revolyssup

@Revolyssup Revolyssup commented Jul 11, 2023

Copy link
Copy Markdown
Contributor

Description

Fixes #9638
Tests to be added

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)

Signed-off-by: revolyssup <[email protected]>
@juststillthinking

Copy link
Copy Markdown
Contributor

Please fix the code lint

@juststillthinking juststillthinking added the wait for update wait for the author's response in this issue/PR label Jul 11, 2023
Signed-off-by: revolyssup <[email protected]>
@Revolyssup

Copy link
Copy Markdown
Contributor Author

Please fix the code lint

@monkeyDluffy6017 Done. Please approve CI

Comment thread apisix/plugins/proxy-rewrite.lua Outdated
Comment on lines +353 to +363
if conf.use_real_request_uri_unsafe and conf.regex_uri then
local index
if separator_escaped then
index = str_find(upstream_uri,"?")
end
if index then
upstream_uri = sub_str(upstream_uri, 1, index - 1)
..sub_str(upstream_uri,index)
end
ctx.var.upstream_uri = upstream_uri
end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do you add these code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right, in the if block above this when the safe encoding was on then this logic was added to first remove the ? and then readd after safely encoding. When we're skipping the safe encoding then we don't need to do any of that but I added it by mistake. Removed this.

Signed-off-by: revolyssup <[email protected]>
AlinsRan
AlinsRan previously approved these changes Jul 14, 2023
Comment thread apisix/plugins/proxy-rewrite.lua

@juststillthinking juststillthinking left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please add blank around the new code block

@Revolyssup

Copy link
Copy Markdown
Contributor Author

Please add blank around the new code block

done

@juststillthinking juststillthinking added approved and removed wait for update wait for the author's response in this issue/PR labels Jul 14, 2023
@juststillthinking
juststillthinking merged commit 2b71d8f into apache:master Jul 14, 2023
membphis added a commit that referenced this pull request May 12, 2026
… levels in v3.x sections (#13360)

- Replace `## Doc improvements` (3.13.0 / 3.14.0 / 3.14.1) and
  `## Developer productivity` (3.13.0) with H3 so they nest under the
  release header instead of starting a new top-level section.
- 3.12.0: correct OpenResty version typo `v1.27.11` -> `1.27.1.1` (#11936).
- 3.11.0: fix plugin name typo `attach-consmer-label` -> `attach-consumer-label` (#11604).
- 3.5.0: the `google-cloud-logging` `client_email` entry referenced #9813
  (proxy-rewrite); the actual PR is #9622.
- 3.0.0: fix `APSISIX` typo in the `enable_cpu_affinity` entry.

Refs #13359.
wistefan pushed a commit to wistefan/apisix that referenced this pull request Jun 16, 2026
… levels in v3.x sections (apache#13360)

- Replace `## Doc improvements` (3.13.0 / 3.14.0 / 3.14.1) and
  `## Developer productivity` (3.13.0) with H3 so they nest under the
  release header instead of starting a new top-level section.
- 3.12.0: correct OpenResty version typo `v1.27.11` -> `1.27.1.1` (apache#11936).
- 3.11.0: fix plugin name typo `attach-consmer-label` -> `attach-consumer-label` (apache#11604).
- 3.5.0: the `google-cloud-logging` `client_email` entry referenced apache#9813
  (proxy-rewrite); the actual PR is apache#9622.
- 3.0.0: fix `APSISIX` typo in the `enable_cpu_affinity` entry.

Refs apache#13359.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

help request: How to use proxy-pass plugin with regex_uri attributes when the url is encoded

4 participants