Hi, now i’m making Reverse Proxy by using Nginx1.25.3(openresty1.25.3.1),
i have one backend
backend1:192.168.62.60
that has no content_path so i set up nginx.conf like below.
and i wanna have other backends so give it a location keyword in the request uri as “/backend1”,
and call proxy_pass with / in the end(remove “/backend1” from request_uri).
then when i was looking into the packets between Nginx and backend1 with WireShark,
i’ve noticed that SYN packets are increased than when i connected directly from browser to backend1.
heard many suggestions that Keep-Alive may be involved, so i tried the parameters related to it, but there was no change.
In the WireShark view,
Connection parameter in the sent HTTP request, are always set as “Keep-Alive”,
but Nginx always sends FIN,ACK packet at the end of each tcp sequence started by one HTTP request from it’s side.
Note: I asked this question because GPT said, ``Adding / to the end of proxy_pass, in other words, rewriting the HTTP request, may increase the number of SYN packets.‘’
with further investigation, i found that backend1 does not support HTTP/1.1, so even though Nginx sends HTTP/1.1 request, backend1 always reply “HTTP/1.0 200 OK”.
In HTTP/1.0, it is correct behavior to create a new socket for each request.
sorry for asking an irrelevant question.
On the other hand, when i directly connect to backend1 with Edge,
Edge does not send FIN,ACK even when it receives “HTTP/1.0 200 OK”, and reuses the socket.
so i look into the “HTTP/1.0 200 OK”, it attached “Connection:Keep-Alive” option.
and i’ve heard that even in HTTP/1.0, it can reuse the socket with the option.
If you upstream service does not support HTTP/1.1, you should remove the proxy_http_version 1.1; from your configuration, as this is setting communication for the upstream to use version 1.1. Without this directive, nginx will default to using HTTP/1 when proxying traffic to the upstream.
i’ve tried it so Nginx sends GET xxxx HTTP/1.0 with Connection:Keep-Alive,
and then upstream replies as HTTP/1.0 200 OK with Connection:Keep-Alive,
but Nginx replies with FIN,ACK to it.