Welcome! Log In Create A New Profile

Advanced

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

December 03, 2017 10:28PM
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@migu.cn (tongshushan@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@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

tongshushan@migu.cn December 01, 2017 08:12AM

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

tokers December 03, 2017 10:28PM

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

tongshushan@migu.cn December 04, 2017 02:52AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 303
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready