openresty / openresty/lua-nginx-module
In order to set the headers of the upstream request, I use `ngx.req.set_header` in `rewrite_by_lua_block`, but my upstream endpoint cannot receive such header.
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 11.8k
- Forks
- 2.1k
- Avg merge
- 6h 1m
- Merged PRs (30d)
- 6
Description
> @agentzh I get a problem here.In order to set the headers of the upstream request, I use `ngx.req.set_header` in `rewrite_by_lua_block`, but my upstream endpoint cannot receive such header. here is my conf.
upstream foo { server 127.0.0.1:6666 weight=1; } server { listen 8001; location / { rewrite_by_lua_block { ngx.req.set_header("Connection", "Upgrade") } proxy_pass http://foo; } } server { listen 8002; location / { proxy_set_header Connection ''; rewrite_by_lua_block { ngx.req.set_header("Connection", "Upgrade") } proxy_pass http://foo; } }request send by
8001port still cannot get the header "Connection: Upgrade"
Have you solved this problem?I have a similar problem,
Originally posted by @djfsb in https://github.com/openresty/lua-nginx-module/issues/437#issuecomment-948387694
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two configurations using rewrite_by_lua_block, ngx.req.set_header, proxy_set_header, and proxy_pass, then inspect what the upstream on port 6666 receives. Done means determining whether the Connection header can be set this way and documenting or correcting the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua, nginx
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100