Welcome! Log In Create A New Profile

Advanced

Re: waiting for full request

Maxim Dounin
September 08, 2022 10:38AM
Hello!

On Wed, Sep 07, 2022 at 09:01:05AM -0400, mirokub wrote:

> Hello,
> Is there a way to configure NGINX to send response (200 OK) only after full
> body of request is delivered?
> Currently the response is sent early before the request body is fully sent.
> More details of my test-case: The request is about 600kB long and it's POST
> method.

The response is sent by nginx when it's available. For static
files and rewrite constructs like "return 200 ok;" this happens
right after the request headers are received, so nginx doesn't try
to wait for the request body before sending the response. In some
cases this might save the client from sending unneeded body to
nginx.

If for some reason you want nginx to only respond when the whole
request body is received, the readily available solution would be
to configured nginx in a way which needs the whole response body
before sending the response. For example, you can configure
additional proxying with proxy_request_buffering switched off (the
default), so nginx will read the whole request body before
proxying the request (and returning the response from the upstream
server):

server {
listen 80;

location / {
proxy_pass http://127.0.0.1:8081;
}
}

server {
listen 127.0.0.1:8081;
return 200 ok;
}

Hope this helps.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

waiting for full request

mirokub September 07, 2022 09:01AM

Re: waiting for full request

Maxim Dounin September 08, 2022 10:38AM

Nginx returning 401

suryamohan05 September 21, 2022 06:15AM

Re: Nginx returning 401

Maxim Dounin September 21, 2022 06:52AM

Re: Nginx returning 401

Sergey A. Osokin September 21, 2022 09:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready