openresty / openresty/lua-resty-core
I use recreate_request in balancer_by_lua_block phase, but it never work.
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 853
- Forks
- 286
- Avg merge
- 35m
- Merged PRs (30d)
- 1
Description
I want to change request header in balancer_by_lua_block phase, because i need to pass host header to next upstream node. I use recreate_request function to change request header information but it doesn't work.
my test example show as follow:
`upstream apisix_backend {
server 0.0.0.1;
balancer_by_lua_block {
local balancer = require "ngx.balancer"
balancer.recreate_request()
ngx.var.domain_host="www.baidu.com"
}
keepalive 320;
}
`
`
location / {
set $upstream_host '';
proxy_set_header Host $upstream_host;
content_by_lua_block {
ngx.say("1");
}
}
`
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 configuration in the issue, focusing on ngx.balancer.recreate_request in the balancer_by_lua_block phase and the interaction with ngx.var.domain_host and proxy_set_header Host. Check the ngx.balancer API behavior and related balancer-phase handling. Done means establishing whether the header change is supported there and fixing or clearly documenting the observed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100