Hello,
How can I have nginx return 204 when send_timeout is triggered?
Thanks so much,
Meir
Posted at Nginx Forum:
Hello,
How can I have nginx return 204 when send_timeout is triggered?
Thanks so much,
Meir
Posted at Nginx Forum:
Thanks so much Maxim, can I send the 204 after a predefined timeout and
after a longer time the send_timeout?
Thanks
Posted at Nginx Forum:
Hello!
On Wed, Dec 10, 2014 at 04:24:09AM -0500, [email protected] wrote:
Hello,
How can I have nginx return 204 when send_timeout is triggered?
After send_timeout it’s already too late to return anything, as
nginx already tried to send the response to the client. If
send_timeout happens, the connection is closed.
–
Maxim D.
http://nginx.org/
Hello!
On Wed, Dec 10, 2014 at 08:29:28AM -0500, [email protected] wrote:
Thanks so much Maxim, can I send the 204 after a predefined timeout and
after a longer time the send_timeout?
Sorry, but I failed to understand the question.
As previously explained, you can’t send anything if send_timeout
is triggered - it’s already too late, as some response was already
send to the client.
–
Maxim D.
http://nginx.org/
Hello!
On Wed, Dec 10, 2014 at 08:58:42AM -0500, [email protected] wrote:
Hello Maxim,
I am so sorry for not being clear.
My question is, can I have the nginx submit a 204 to the client after a
predefined time?
Yes, but that’s not a trivial task when using vanilla nginx. For
example you can do this using the embedded perl module,
$r->sleep() command:
location / {
perl 'sub {
my $r = shift;
$r->discard_request_body;
sub next {
my $r = shift;
$r->status(204);
$r->send_http_header;
}
$r->sleep(1000, \&next);
}';
}
See Module ngx_http_perl_module for more details.
This can be also done using 3rd party modules. E.g., using the
delay module as available from
ngx_http_delay_module: log,
this can be done as follows:
location / {
delay 2s;
error_page 403 = /empty;
deny all;
}
location = /empty {
return 204;
}
–
Maxim D.
http://nginx.org/
Hello Maxim,
I am so sorry for not being clear.
My question is, can I have the nginx submit a 204 to the client after a
predefined time?
Thanks so much,
Meir
Posted at Nginx Forum:
Got it, will try it out.
Thanks so much.
Meir
Posted at Nginx Forum:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs