openresty / lua-nginx-module

Embed the Power of Lua into NGINX HTTP servers
https://openresty.org/
11.33k stars 2.04k forks source link

cant not in header_filter_by_lua , use ngx.req.set_header() func??? #1624

Open yyong-brs opened 4 years ago

yyong-brs commented 4 years ago

i want to use ngx.req.set_header to reset request header,use $upstream_addr variables, but i try ,then not effect ,please tell me how to do this? tks

locao commented 4 years ago

In the header filter phase, Nginx already sent the request to the upstream, so there's no effect in changing headers. You should change the headers in the access phase if you want them to be sent to the upstream.