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: As a user, I want to make regex-uri able to use nginx context variables for Plugin [proxy-rewrite] #11224

Open
V1endr3 opened this issue May 5, 2024 · 1 comment · May be fixed by #11225

Comments

@V1endr3
Copy link

V1endr3 commented May 5, 2024

Description

Make regex-uri of proxy-rewrite able to use nginx context variables.

Currently, APISIX's plugin proxy-rewrite can rewrite URIs through one of uri and regex_uri.
While using uri, I can pass in a nginx context variable like ${http_SOME_HEADER} to make a header fill into the URI.
While using regex_uri, the only thing I can do is pass in the result of a regex match like $1,$2,etc.
regex_uri feature does not support using nginx context variables to fill a URI.

We have to give up using the nginx context variable if we need to use the regex pattern.

We could consider making it possible by modifying the order of regex match to make it possible to use both of them.
Firstly, fill in nginx context variables and make variables like $1,$2 remain there.
Secondly, match the result of the former step with a regex pattern.

Examples

I have a header like "X-Test-Path: demo", and wanna make it into path while parsing it.

Origin:

  • uri: /test/tpath/var?a=1
  • headers:
    • X-Test-Path = demo

Expect:

  • uri: /test/demo/var
  • headers:
    • X-Trans-Path = tpath

I'd like to contribute to this issue!

@V1endr3 V1endr3 changed the title feat: make regex-uri able to use nginx variables for Plugin [Proxy-rewrite] feat: As a user, I want to make regex-uri able to use nginx context variables for Plugin [proxy-rewrite] May 6, 2024
@shreemaan-abhishek
Copy link
Contributor

I do not agree with this use case going forward. The regex_uri feature is only for uri, it's better to use the serverless plugin for such a niche/customized use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

Successfully merging a pull request may close this issue.

2 participants