hey friends:I have some problems in using balance_by_lua module. Here is my code :
-----------------------------------------------------------------------------------------------
proxy_next_upstream error timeout invalid_header non_idempotent http_502 http_504;
proxy_next_upstream_tries 4;
upstream backend {
server 0.0.0.1;
balancer_by_lua_block {
local balancer = require "ngx.balancer"
local host, port = select_backend()
balancer.set_current_peer(host, port)
}
-----------------------------------------------------------------------------------------------
when the upstream status is 502 or 504, I can select a new backend. Now, I want to set different http header for different upstream backend. But we know that ngx.req.set_header function can not be used in balancer_by_lua* status. So, does anyone has some good idea to solve this problem?