hi,
如题所示,我想要自定义 504 gateway timeout 返回的内容,以下是 nginx.conf 的部分代码
proxy_intercept_errors on;
proxy_pass $url;
proxy_read_timeout 5s;
error_page 504 =200 /504.json;
location ~*/504\.json{
echo '{"RetCode":110, "Message":"Action Time out"}';
}
这种情况下,是能够正常返回这个 504.json 的内容的。
但是需求是不能够给这个 proxy_pass 设置过期时间,就是 proxy_read_timeout 5s; 这一句必须要注释掉。
注释掉后,就不能正常返回 504.json 了,这个 error_page 就不能正常工作了,直接返回一个 504 Gateway Time out.
向大家请教下,这样是为什么呢?还有,怎样才能解决这个问题呢?