Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Nginx Proxy Manager and 502 Bad Gateway

Featured Replies

Hello together!
Yesterday I installed Nginx Proxy Manager on my Unraid and so far redirects work on Ips that are not the same as the server itself. But as soon as I want to use a bridge Ip I get the error "502 Bad Gateway".
The thousands of solutions like restarting or similar did not help me. 
Also with mobile data the same error occurs.

Do you have any suggestions?

Edited by Boen

  • Boen changed the title to Nginx Proxy Manager and 502 Bad Gateway
  • 4 months later...

Hi There,

I see that this post has been up for a few months and you haven't got a reply yet. Hopefully you managed to resolve your issue. I ran into the same issue myself and found a solution so I thought I'd better post it here:

In my case, the issue was that the NGINX Proxy Manager docker defaults to being on the custom br0 network, while all my other docker containers (which I'm trying setup reverse proxies to) are on the bridge network. Switching those other docker containers to the br0 network as well, OR changing the Settings->Docker->"Host access to custom networks" setting to "Enabled" resolved the issue for me.

In the end I went with switching those Docker containers to the same custom network as that seemed the more secure of the two options.

  • 3 months later...

[Edit]  I forgot to mention I'm running Unraid Version: 6.11.5 (Trial: 8 days left)

 

I'm new to Unraid and new-ish to docker and am seeing this as well from what I can tell.  I'm hoping if I try to explain it, the solution will present itself :).   My setup is currently as follows:

 

Unraid Server

IP:  192.168.0.243

 

Nginx Proxy Manager docker container (unraid hosted):

Network type:  Custom:br0 

Static IP:  192.168.0.253

Listening ports:  

  • 192.168.0.253:443/TCP <--> 192.168.0.253:443
  • 192.168.0.253:80/TCP <--> 192.168.0.253:80
  • 192.168.0.253:81/TCP <--> 192.168.0.253:81

Ombi docker container (unraid hosted):

Network type:  Host (unraid)

Listening ports:

  • 192.168.0.243:3579/TCP <--> 192.168.0.243:3579

According to this configuration, if I browse to the Unraid server IP using the Ombi port at http://192.168.0.243:3579/  I should be able to see the Ombi application.  This in fact does work:

 

     image.png.1a713b6863bab1047d44f564196e4a79.png

 

For this test now, I've configured my local /etc/hosts file to resolve mydomain.com to the Unraid IP:

 

     image.png.703dc7aec8934eb6be51af66164c3d55.png

 

I now I want Nginx to redirect this domain using HTTP to the Ombi service.  On Nginx I have the following proxy host:

     image.png.760d92cca25e859afebed21a459e4dde.png

 

Given Nginx-Proxy-Manger is running at 192.168.0.253 and listening on ports 80/443, I would think that going to http://mydomain.com/ would redirect to Ombi at http://192.168.0.243:3579.  However, this returns a 502-Bad Gateway:

 

     image.png.5d9cfc46987706cf4f0966b073deb735.png

 

If I change the Ombi container's Network type to Bridge, the port mapping looks as follows:

 

     172.17.0.2:3579/TCP <--> 192.168.0.243:3579

 

I can still hit Ombi directly at http://192.168.0.243:3579, but still get a 502-Bad Gateway going through Nginx-Proxy-Manager.  I also tried using the Ombi container's internal Nat IP 172.17.0.2, but I eventually get 504-Gateway Time-out (I expected this to fail).  

 

The only way it works for me is if I change the Ombi container Network type to be "Custom:br0" with static IP 192.168.0.210.  Now http://mydomain.com works just fine!

 

     image.png.4827051d26127e7330f7474a45ccf333.png

 

Can anyone explain why Nginx-Proxy-Manager won't redirect to the Unraid server IP+Ombi port even though the application works fine when hit directly?

 

Thanks so much!

Edited by PredatorVI

  • 10 months later...
On 9/23/2022 at 11:21 AM, Jorddahmann said:

Hi There,

I see that this post has been up for a few months and you haven't got a reply yet. Hopefully you managed to resolve your issue. I ran into the same issue myself and found a solution so I thought I'd better post it here:

In my case, the issue was that the NGINX Proxy Manager docker defaults to being on the custom br0 network, while all my other docker containers (which I'm trying setup reverse proxies to) are on the bridge network. Switching those other docker containers to the br0 network as well, OR changing the Settings->Docker->"Host access to custom networks" setting to "Enabled" resolved the issue for me.

In the end I went with switching those Docker containers to the same custom network as that seemed the more secure of the two options.

Changing the Docker Settings to Access Custom Networks worked for me. Thanks!!

  • 4 weeks later...

@Jorddahmann This worked perfectly!!  Thank you!  I was pulling my hair out.

  • 3 weeks later...

I have the same problem, I have vaultewarden running behinf nginx and both are on br0 I still get a bad gateway response. I now enabled custom networks in docker but that did not help either. One thin I noticed is that docker custom network setting is set to 

Docker custom network type:

ipvlan

 

could that be the problem?

On 9/23/2022 at 10:21 AM, Jorddahmann said:

Hi There,

I see that this post has been up for a few months and you haven't got a reply yet. Hopefully you managed to resolve your issue. I ran into the same issue myself and found a solution so I thought I'd better post it here:

In my case, the issue was that the NGINX Proxy Manager docker defaults to being on the custom br0 network, while all my other docker containers (which I'm trying setup reverse proxies to) are on the bridge network. Switching those other docker containers to the br0 network as well, OR changing the Settings->Docker->"Host access to custom networks" setting to "Enabled" resolved the issue for me.

In the end I went with switching those Docker containers to the same custom network as that seemed the more secure of the two options.

 

Had an update go bad and lost some settings and all of a sudden Tautulli was giving this error. This is exactly what I needed to fix it.

  • 2 weeks later...
On 12/17/2023 at 10:56 AM, geefle said:

I have the same problem, I have vaultewarden running behinf nginx and both are on br0 I still get a bad gateway response. I now enabled custom networks in docker but that did not help either. One thin I noticed is that docker custom network setting is set to 

Docker custom network type:

ipvlan

 

could that be the problem?

I figured it out. I got myself confused and configured nginx to access vaultwarden using https. whihc obviously is not possible. When I changed that to http it worked.

  • 3 months later...

Just a quick reply that

Settings->Docker->"Host access to custom networks" setting to "Enabled"

worked for me too.  Now I just have to create entries for the other 20+ docker containers. ugh 

Note, I did NOT have to change custom bridge or IP settings.  NPM is running in 'custom: br0' network type and it can see all the other docker containers in 'bridge' or 'medianet' networks just fine.

Edited by yoleska

  • 8 months later...
On 1/3/2023 at 9:27 PM, PredatorVI said:

[Edit]  I forgot to mention I'm running Unraid Version: 6.11.5 (Trial: 8 days left)

 

I'm new to Unraid and new-ish to docker and am seeing this as well from what I can tell.  I'm hoping if I try to explain it, the solution will present itself :).   My setup is currently as follows:

 

Unraid Server

IP:  192.168.0.243

 

Nginx Proxy Manager docker container (unraid hosted):

Network type:  Custom:br0 

Static IP:  192.168.0.253

Listening ports:  

  • 192.168.0.253:443/TCP <--> 192.168.0.253:443
  • 192.168.0.253:80/TCP <--> 192.168.0.253:80
  • 192.168.0.253:81/TCP <--> 192.168.0.253:81

Ombi docker container (unraid hosted):

Network type:  Host (unraid)

Listening ports:

  • 192.168.0.243:3579/TCP <--> 192.168.0.243:3579

According to this configuration, if I browse to the Unraid server IP using the Ombi port at http://192.168.0.243:3579/  I should be able to see the Ombi application.  This in fact does work:

 

     image.png.1a713b6863bab1047d44f564196e4a79.png

 

For this test now, I've configured my local /etc/hosts file to resolve mydomain.com to the Unraid IP:

 

     image.png.703dc7aec8934eb6be51af66164c3d55.png

 

I now I want Nginx to redirect this domain using HTTP to the Ombi service.  On Nginx I have the following proxy host:

     image.png.760d92cca25e859afebed21a459e4dde.png

 

Given Nginx-Proxy-Manger is running at 192.168.0.253 and listening on ports 80/443, I would think that going to http://mydomain.com/ would redirect to Ombi at http://192.168.0.243:3579.  However, this returns a 502-Bad Gateway:

 

     image.png.5d9cfc46987706cf4f0966b073deb735.png

 

If I change the Ombi container's Network type to Bridge, the port mapping looks as follows:

 

     172.17.0.2:3579/TCP <--> 192.168.0.243:3579

 

I can still hit Ombi directly at http://192.168.0.243:3579, but still get a 502-Bad Gateway going through Nginx-Proxy-Manager.  I also tried using the Ombi container's internal Nat IP 172.17.0.2, but I eventually get 504-Gateway Time-out (I expected this to fail).  

 

The only way it works for me is if I change the Ombi container Network type to be "Custom:br0" with static IP 192.168.0.210.  Now http://mydomain.com works just fine!

 

     image.png.4827051d26127e7330f7474a45ccf333.png

 

Can anyone explain why Nginx-Proxy-Manager won't redirect to the Unraid server IP+Ombi port even though the application works fine when hit directly?

 

Thanks so much!


After a lot of digging I now understand the issue.

The issue is that loopback is not allowed in docker by default which means that if you setup Nginx Proxy Manager to have its on ip when begin hosted from unraid and try to proxy a service/app also hosted in unraid but using port forwarding or a different network.

A way to fix this is to make your Nginx Proxy Manager join the other service/app network to do so edit your Nginx Proxy Manager config,

 

go into the advanced view and in post arguments enter the following `&& docker network connect <network> <container>` replace the <network> with the network name of the service and <container> with the name of your Nginx Proxy Manager container.

For example here is my config:
&& docker network connect immich_default Nginx-Proxy-Manager-Official

 

now that your networks are connected you can reference the service by the host name (often the container name not sure if this is true 100% of the time)

credit: 


As an extra note you could create a new network in docker and have all your containers join it, then have your Nginx Proxy Manager also join that docker network and it should have access to all the services/apps that are in the network.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.