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

The proxy-rewrite plugin does not support pass nginx's variable within header #3117

Closed
yongboy opened this issue Dec 24, 2020 · 4 comments · Fixed by #3144
Closed

The proxy-rewrite plugin does not support pass nginx's variable within header #3117

yongboy opened this issue Dec 24, 2020 · 4 comments · Fixed by #3144
Assignees
Labels
good first issue Good for newcomers

Comments

@yongboy
Copy link
Contributor

yongboy commented Dec 24, 2020

Issue description

I want to pass the nginx's Embedded Variables for upstream applications, below is my proxy-rewrite plugin's config:

{
    "headers": {
        "X-AUTH-UID": "$arg_uid"
    },
    "regex_uri": [
        "^/monitor/(.*)",
        "/$1"
    ]
}

The test url:

curl http://gw.dev/monitor/hello?uid=10001

The upstream application got the raw req info below:

GET /hello?uid=10001 HTTP/1.1
Host: gw.dev
X-Real-IP: 172.19.0.1
X-Forwarded-For: 172.19.0.1
X-Forwarded-Proto: http
X-Forwarded-Host: gw.dev
X-Forwarded-Port: 9080
User-Agent: curl/7.64.1
Accept: */*
X-AUTH-UID: $arg_uid

......

Environment

  • apisix version : 1.5
  • OS: MacOS
  • OpenRestyx / Nginx version: nginx/1.17.3
@spacewander
Copy link
Member

Only constant value is supported.

@spacewander spacewander added the good first issue Good for newcomers label Dec 24, 2020
@Firstsawyou
Copy link
Contributor

Assigned to me.

@BFergerson
Copy link
Member

I believe I'm facing a similar issue. I am trying to use two plugins to create a sort of password-protected area in my application. I was hoping to use the basic-auth plugin for username/password functionality and proxy-rewrite to automatically add the username to the route. For example, rerouting requests to host:3000 to host:3000/{username}.

Is that similar to this issue and would it be solved with work done on this issue?

@spacewander
Copy link
Member

@BFergerson
It is another thing since the username is not exposed to ctx.var yet. You might need to open a new issue for it.

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

Successfully merging a pull request may close this issue.

4 participants