Hello everyone,
I’m encountering a configuration issue between my QNAP (QTS) and Nginx Proxy Manager (NPM), which is rendering my Fail2ban (or QTS access protection) ineffective against brute-force attacks.
My configuration:
QNAP (QTS): Local IP 192.168.10.10 (I changed it to a standard RFC1918 IP address, but you can use your own)
Nginx Proxy Manager: Local IP 192.168.10.6 (on a Docker container or a separate VM)
Goal: Access QTS via a domain name (e.g., myqnap.domain.com) using NPM for SSL and reverse proxy.
The problem:
Access works perfectly. My domain name points to my router, which forwards ports 80/443 to Nginx Proxy Manager (100.6), and NPM then redirects the traffic to my QNAP (100.10).
The problem is that QTS doesn’t see the true source IP (public IP) of visitors.
When a connection attempt fails (brute-force attack), the QTS security logs indicate that the attempt originated from IP 100.6 (the IP of my Nginx Proxy Manager).
The consequence: If I enable IP access protection or Fail2ban on the QNAP to block IPs after several failed attempts, it blocks the IP of my Nginx Proxy Manager (100.6).
Result:
The attacker is never banned.
My own proxy is banned, which cuts off access to QTS for all legitimate users.
My question: How can I configure Nginx Proxy Manager to correctly forward the source IP address (via the X-Forwarded-For or X-Real-IP headers) AND how can I configure QTS to read and trust this header?
I’ve looked in the NPM options (I’ve checked “Forward Client-IP” and “Forward Hostname”), but QTS still seems to see the proxy’s IP address. Do I need to add a custom configuration in Nginx (via the “Advanced” tab in NPM) or is there a hidden setting in QTS to “trust” a proxy?
Thanks in advance for your help!