1
I'm trying to configure Nginx to reverse proxy port 445, but every time client A is connected to the share through Nginx and a client B connects I have the connection of client A dropped by Nginx even though he was actively using the share (downloading a big file, for example). It's like Nginx is reusing the connection for client B before client A finishes using it.
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log debug;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
server {
listen 445;
proxy_pass storage:445;
}
}
What's missing in the config file above to allow both client A and B to use the share simultaneously without dropping one connection to stablish the other?
Some extra context:
Nginx v. 1.17.1 runing on Ubuntu 18.04.2 LTS virtual machine 4 vCPU and 4Gb mem ;
I have already tried making this control using iptables instead of Nginx to forward the connections on port 445 to the share server and the result was similar: client A has its connection dropped when B connects;
The share works fine if the clients A and B connects directly to the storage share without Nginx between them;
I have tried quite a lot of recomended configurations from Nginx documentation (limit_conn, so_keepalive, reuseport....), but I might have misused them;
From Wireshark I see Nginx sends a [FIN, ACK] packet to client A when client B connects;
Log of Nginx when client A has its connection afected: *[error] 32110#32110: 7 recv() failed (104: Connection reset by peer) while proxying and reading from upstream... but I notice this log is related to a [RST, ACK] packet client A sends to Nginx even after that [FIN, ACK] packet it received.
Edit:
Tried with the newer version 1.17.3 and no success.
Wait, what's the reason to proxy SMB through Nginx in the first place? – user1686 – 2019-09-10T18:27:07.967
@grawity, I have some legacy apps on a windows server 2003 that I want to migrate to a newer server. But the apps were badly written and have IP and/or DNS hardcoded (I don't have the codes). Database and app were on the same box, but I don't want it like this from now on. My problem is that I can't separete the apps from databases without crashing the apps. The solution I found was to use a Nginx reverse-proxy keeping the old server IP and DNS and redirecting the SMB to the new app server and database to the new database server. Is there a better way to achieve this? – Ronaldo – 2019-09-10T18:52:44.927