P
P
pinklisaped2021-10-13 02:46:47
Nginx
pinklisaped, 2021-10-13 02:46:47

Nginx, is it possible to proxy each client with a separate socket?

I ran into a problem when developing a complex balancing application for the body of an http request, in one socket from nginx data can arrive from two different clients in the load. Debugging has to be done through an ssh tunnel from the test server due to network delimitation.

Config indicating http 1.1

location / {
    proxy_pass http://backend;
    proxy_http_version 1.1;
    proxy_set_header Connection $connection;
}


upstream backend{
    server 127.0.0.1:12321;
    keepalive 32;
}


  • Without the keepalive parameter in the upstream, nginx proxies with the keep-alive header, and after the application responds, it closes the connection.
  • With a header at low load, it proxies exactly 1 to 1.
  • When high, nginx can write data from 2 clients to 1 socket, which interferes with the asynchronous structure of the application.


Tell me, please, in which direction to look, what parameter indicates this behavior, if any.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question