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

request help: how to rewrite query parameters using proxy-rewrite #1801

Closed
zTrix opened this issue Jul 3, 2020 · 2 comments · Fixed by #1816
Closed

request help: how to rewrite query parameters using proxy-rewrite #1801

zTrix opened this issue Jul 3, 2020 · 2 comments · Fixed by #1816
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@zTrix
Copy link

zTrix commented Jul 3, 2020

Issue description

'?' symbol would be encoded to 0x3f when using proxy-rewrite directive.

https://github.com/apache/incubator-apisix/blob/794b1eb65e01e0e15d3dcd9cf1f0d74166e9b246/apisix/plugins/proxy-rewrite.lua#L156

Is there any way to rewrite url to append some more query parameter to the original path?

It would be highly appreciated if rewriting query parameter could be supported like in nginx: https://serverfault.com/questions/311487/nginx-rewrite-append-a-parameter-at-the-end-of-an-url

Environment

  • apisix version (cmd: 1.3):
  • OS: Linux
@membphis
Copy link
Member

membphis commented Jul 3, 2020

this should be a bug, we should only encode uri.

here is the fake code, welcome PR ^_^

local path, arg = split_uri(uri)
path = uri_safe_encode(path)
return path .. arg

@membphis membphis added the bug Something isn't working label Jul 3, 2020
@moonming moonming added the good first issue Good for newcomers label Jul 7, 2020
@xxm404
Copy link
Contributor

xxm404 commented Jul 7, 2020

Hi @moonming you can assign this issue to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants