NPM Get Real IP of Incoming https Connections #4798
              
                Unanswered
              
          
                  
                    
                      Trembler34
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 0 comments
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I have been pulling my hair out over this. Been trying for the last few days to get NPM to pass the real IP of the incoming HTTPS connections but it continues to show the Container IP..
Enviornment is Debian 13, w Docker/portainer/NPM and the app I am mostly trying to get to pass the real IP to is SFTPGo.
SFTPGo is currently configured to enable the proxy protocol, alllowing the IP of the Proxy. However, the issue comes in when I try to use the whitelist of Allowed IPs, it doesn't function properly because SFTPGo is only seeing remote addr=172.17.0.1 no matter where I connect from externally.
Can someone please tell me how i can get NPM to pass the real IP from the Proxy Host configured inside NPM, down to the SFTPGo container so it identifies the external IP of all connecting hosts? I have tried all sorts of different things and nothing is working (including solutions from other threads in here) I wouldn't mind doing this on a global scale, so for any future projects it will always show the real IP.. But if that can't be done. I need to at least get this working for this proxy host in question.
I have added this into the Custom Config - with no difference
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Here is what the log looks like for all incoming connections through NPM > SFTPGo
2025-10-13T16:25:58.362 DBG sender=httpd local_addr=172.17.0.3:8080 method=GET proto=HTTP/1.1 remote_addr=172.17.0.1:44330 request_id=4e7bb1951e04/kSkM2YBUWY-000017
You can see remote_addr is the container IP..
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions