lua code in log_by_lua_file not executed when the upstream server is down

Zhang Chao zchao1995 at gmail.com
Mon Dec 4 03:26:49 UTC 2017


Hi!

I think you should paste this issue to the openresty mail list
https://groups.google.com/forum/#!forum/openresty-en

For this problem, have you configured any error_page directives? the
error_page will trigger an internal redirect.


On 1 December 2017 at 21:10:12, tongshushan at migu.cn (tongshushan at migu.cn)
wrote:

the nginx.conf as below:

upstream my_server {
    server localhost:8095;
    keepalive 2000;
}

location /private/rush2purchase/ {
    limit_conn addr 20;
    proxy_pass http://my_server/private/rush2purchase/;
    proxy_set_header Host $host:$server_port;
    rewrite_by_lua_file D:/tmp/lua/draw_r.lua;
    *log_by_lua_file* D:/tmp/lua/draw_decr.lua;
}

when I send request to http://localhost/private/rush2purchase/
 ,it works fine the the stream server is up,
but when I shutdown the upstream server(port:8095)
,I find the code not executed in *log_by_lua_file *(draw_decr.lua).

*info in nginx access.log:*
127.0.0.1 - - [01/Dec/2017:21:03:20 +0800] "GET
/private/rush2purchase/ HTTP/1.1"
*504 *
558 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/63.0.3236.0 Safari/537.36"

*error message in nginx  error.log:*
2017/12/01 21:02:20 [error] 35292#42868: *3298 upstream timed out
(10060: A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection
failed because connected host has failed to respond) while connecting
to upstream, client: 127.0.0.1, server: localhost, request: "GET
/private/rush2purchase/ HTTP/1.1", upstream: "http://
[::1]:8095/private/rush2purchase/", host: "localhost"
2017/12/01 21:03:20 [error] 35292#42868: *3298 upstream timed out
(10060: A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection
failed because connected host has failed to respond) while connecting
to upstream, client: 127.0.0.1, server: localhost, request: "GET
/private/rush2purchase/ HTTP/1.1", upstream: "
http://127.0.0.1:8095/private/rush2purchase/", host: "localhost"

How to fix it?


------------------------------

Tong
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20171203/7fe821df/attachment.html>


More information about the nginx mailing list