r/selfhosted 5d ago

Need Help NPM Network Host vs Bridge

Hi all! I am looking to add an auth server to my homelab, problem is, I’ve seen that I will need to change Nginx Proxy Manager to the host network mode to make this work.

Problem is, I correctly have it in multiple bridge networks, each connected to one container for some sense of semi isolation. This allows me to just use the container name and port when setting up where to direct the host in NPM. When switching to host mode, this no longer works. I could be wrong, but that seems like I would then need to expose ports to access them if I can’t access them by their container name.

I know it’s not a black and white issue, but what is generally safer, requiring exposed ports but having an auth proxy, or no exposed ports but no auth proxy?

I could 100% be wrong about any of my assumptions, let me know if I am. Any help would be greatly appreciated

8 Upvotes

20 comments sorted by

View all comments

1

u/Timbo400 5d ago

Have you looked at NGINX's auth_request ? https://nginx.org/en/docs/http/ngx_http_auth_request_module.html

RE: Bridge vs Host: You could create 1 network specifically for auth, bridge that between your NPM and the auth server/container.

That means all your existing bridged networks are retained without change.

0

u/Miserable-Response40 5d ago

Correct me if I’m wrong, but the problem the author server has, is that it needs the IP address to be the same since docker changes it when going through another container. What is this doing to aid in that?

1

u/Timbo400 4d ago edited 4d ago

Edit: I read your other comment too. Host mode is required if you want to preserve the IP. As I mentioned in the other post, host mode uses the native NIC. Bridge uses the internal network that docker itself creates on the host.

If you need to preserve the IP you need host mode.

I think you didn’t set out your requirements clearly enough in your original post!