ngx.location.capture在负载均衡下会超时

54 views
Skip to first unread message

张晗

unread,
Aug 12, 2022, 4:42:14 AM8/12/22
to openresty
发现在method为非get请求时,子请求会一直pending住到超时。
我配置如下:
location = /test {
content_by_lua_block {
local res = ngx.location.capture("/aaa", {method = ngx.HTTP_POST})
ngx.status = res.status
return ngx.say(res.body)
}
}

然后子请求会命中这里:
location / {
proxy_pass http://up;
}

关于up我是这样写的:
upstream up {
server 127.0.0.1:9092;
server 127.0.0.1:9093;
}

server {
listen 9092;
server_name up1;
location / {
proxy_pass http://10.219.204.43:8018;
}
location = /status {
access_log off;
proxy_pass http://10.219.204.43:8018;
}
}

server {
listen 9093;
server_name up2;
location / {
proxy_pass http://10.219.204.43:8018;
}
location = /status {
access_log off;
proxy_pass http://10.219.204.43:8018;
}
}
Reply all
Reply to author
Forward
0 new messages