Welcome! Log In Create A New Profile

Advanced

Re: pre-existing data on a connection

Maxim Dounin
January 09, 2020 09:58AM
Hello!

On Mon, Jan 06, 2020 at 04:32:24PM -0800, Frank Liu wrote:

> When using nginx as a reverse proxy, how does it handle the
> pre-existing data on a keepalive connection to the backend?
>
> eg: for a request, the backend has a bug that sends 2 identical
> responses. I assume nginx will take the first response and send it to
> client. What will happen to the extra data (duplicate response)? Now
> when nginx gets a second request and re-uses the same keepalive
> connection to backend, will nginx take the pre-existing data (the
> duplicate response for the first request) on that connection and send
> it to second client or will it drop those and read the new response
> from backend to send to client?
> If nginx uses the pre-existing data, all the subsequent requests will
> get the response shifted.

The behaviour heavily depends on the timing. As long as nginx
will be able to detect there are additional data after the
response is already sent, nginx will close the connection (and
will use another one for the next request to the same upstream
server). It might not be able to detect there are additional
data though, and will only read the duplicate response after it
will sent the next request to the connection, so the duplicate
response will be sent to the second client.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

pre-existing data on a connection

Frank Liu January 06, 2020 07:34PM

Re: pre-existing data on a connection

Maxim Dounin January 09, 2020 09:58AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
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