Docker NPM proxy not forwarding traffic while other reverse proxies work fine

I’m running Nginx Proxy Manager inside a Docker container to test it out, but I’m having trouble getting it to forward requests properly unlike other proxy solutions.

My setup looks like this:
Client_Machine:port —> proxy_container —> backend_service:80

Both the proxy container and backend service are on the same Docker bridge network, and the external port is properly exposed.

I’ve tested with regular Nginx and Caddy as reverse proxies and they work perfectly - when I hit http://Client_Machine:port the page loads without any problems. However, NPM refuses to pass through the requests to the backend.

What’s really puzzling is that when I exec into the NPM container and run curl backend_service:80 directly, it connects and returns the expected response just fine.

Has anyone encountered this issue before? What could be causing NPM to behave differently than other proxy servers in the same configuration?

Check your npm container logs when making requests - npm sometimes has permission issues with docker bridge networks that don’t show up in other proxies. Try recreating the proxy host entry from scratch, I’ve seen npm cache old configs even after editing. Also make sure your backend service isn’t binding to localhost only, it needs to bind to 0.0.0.0:80

Docker DNS resolution timing is probably your issue. NPM has way stricter timeout settings than regular Nginx or Caddy setups. I hit this exact problem moving from Traefik to NPM - everything looked right but requests just hung or timed out. Fix was bumping the upstream timeouts in NPM’s custom config section. Add proxy_connect_timeout, proxy_send_timeout, and proxy_read_timeout directives - set them to something like 60s each. NPM’s defaults are super aggressive and don’t mesh well with backends that need time to respond on initial connections, even when direct curl works fine.

I faced a similar issue with Nginx Proxy Manager. The problem stemmed from incorrect configuration in the proxy host settings. Unlike standard Nginx or Caddy, NPM may have specific settings that can disrupt traffic forwarding. Ensure that your target hostname/IP is precisely set to “backend_service” and that port 80 is specified. Additionally, remember to use “http” instead of “https” for the scheme. It’s also beneficial to review your SSL settings and consider turning off “Block Common Exploits,” as this can interfere with traffic. Enabling access logs in NPM can help you trace if incoming requests are being processed correctly.

The Problem: You’re experiencing issues with Nginx Proxy Manager (NPM) in a Docker container, where it fails to forward requests to a backend service on the same Docker network, even though other proxy servers (like Nginx and Caddy) work correctly in the same configuration. Directly accessing the backend service from within the NPM container works fine, indicating a problem with NPM’s internal routing or configuration, not with the backend or network connectivity itself.

:thinking: Understanding the “Why” (The Root Cause):

The problem likely stems from differences in how NPM handles internal Docker DNS resolution and service discovery compared to other proxy servers. While other proxies might seamlessly resolve service names within the Docker network, NPM may have stricter timeout settings or different mechanisms for looking up backend addresses. This can lead to silent failures where requests appear to be lost without clear error messages, especially when dealing with containers on a macvlan network where direct IP addresses are often used. Also, NPM’s default configuration might not be perfectly suited for all backend services, potentially leading to incompatibility with some connection protocols.

:gear: Step-by-Step Guide:

  1. Verify Docker Network Configuration and DNS Resolution: The first step is to confirm that your Docker network is properly configured and that DNS resolution is working correctly within the network. Ensure both your NPM container and backend service are using the same network, that the backend service is reachable via its hostname or IP address from within the NPM container (using ping or curl), and that the hostnames or IP addresses are correctly configured in NPM.

  2. Check NPM Configuration for Timeouts: NPM has relatively aggressive timeout settings by default. These timeouts may be causing the issue if your backend service is slow to respond on the initial connection. To troubleshoot this, you’ll need to add custom Nginx configuration to extend the timeouts. Access the Advanced settings in NPM and add the following directives to your Nginx configuration:

proxy_connect_timeout 60s;
proxy_send_timeout 60s;
proxy_read_timeout 60s;
  1. Review Proxy Host Configuration in NPM: Incorrectly configuring the proxy host in NPM is another common issue. Double-check the following:
  • The hostname or IP address of your backend service is correctly set to backend_service (or the actual name/IP).
  • The port is correctly specified as 80.
  • The scheme is set to http (assuming your backend service uses HTTP, adjust if it’s https).
  • Any other specific requirements that your backend service might have for things like host headers or connection protocols are addressed in the NPM’s custom configuration area.
  1. Examine NPM Logs for Errors: If you’ve reviewed the above settings and no resolution was found, it’s crucial to examine NPM’s logs for any errors or warnings that might shed more light on the problem. Enable NPM’s access logs to get better visibility into what’s going on. Look for connection errors, timeout errors, or any indications of the requests failing to reach your backend.

  2. Recreate the Proxy Host Entry: In some cases, NPM might be caching an old or incorrect configuration even after editing. Try removing and recreating the proxy host entry in NPM to ensure that it’s using the updated settings.

  3. Consider Alternatives (If Necessary): If the issues persist after thoroughly investigating the above points, it might be worth exploring alternative proxy solutions or approaches to simplify the networking configuration, especially if you’re working with Docker macvlan.

:mag: Common Pitfalls & What to Check Next:

  • Docker DNS Resolution: Ensure that your Docker setup correctly handles internal DNS. The backend service’s name may not be resolved properly within the NPM container if your DNS settings aren’t fully configured.
  • Backend Service Binding: Verify that your backend service isn’t binding to localhost but instead to 0.0.0.0 (all interfaces) on port 80 so it’s accessible from other containers on the same network.
  • Firewall Rules: Although less likely in a Docker environment, verify your host system and Docker’s firewall rules aren’t blocking traffic between the NPM container and the backend service.

:speech_balloon: Still running into issues? Share your (sanitized) config files, the exact command you ran, and any other relevant details. The community is here to help!

Had the same problem with NPM six months ago. NPM drops WebSocket connections and HTTP upgrade headers by default - even when curl works fine inside the container, NPM silently kills connections your backend needs. Fixed it by adding custom Nginx config in the Advanced settings tab. Set proxy_http_version to 1.1 and configure the proxy_set_header Upgrade and Connection headers properly. NPM’s GUI hides these settings unlike raw Nginx. Also check if your backend expects specific Host headers - NPM mangles these differently than other reverse proxies, especially with custom domains or non-standard ports.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.