You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
The text was updated successfully, but these errors were encountered:
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
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.
Description
Make
regex-uri
of proxy-rewrite able to use nginx context variables.Currently, APISIX's plugin
proxy-rewrite
can rewrite URIs through one ofuri
andregex_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:
Expect:
I'd like to contribute to this issue!
The text was updated successfully, but these errors were encountered: