Forward every port from Nginx Proxy Manager to Home Assistant

If I want to connect remotely to my home assistant instance, I visit a certain website which goes through Cloudflare which then puts my connection through a tunnel to the Cloudflared add-on on my home assistant instance. From there, my connection goes through the nginx proxy manager which forwards the connection to the ip of the raspberry pi where my home assistant instance sits on and through the port 8123, which is the port for home assistant.

Now, I want to access multiple or any ports remotely in this way. Port 8123 is fine for most things. But for example the web interface of nginx proxy manager does not use this port which means that I cannot access it remotely since I can only access the one configured port 8123.

Is is possible to achieve what I want?
I thought of just letting every port in the advanced configuration of npm though but this did not work.

As a minimum setup you would just define all of the IP:port entries in the Cloudflared addon, and would not need NPM for this purpose. The config would look something like:

- hostname: site1.mydomain.com
  service: http://192.168.0.111:1234
- hostname: site2.mydomain.com
  service: http://192.168.0.222:5678

In the above example, site1 might be your HA and site2 your NPM.

Assuming you’re using the NGINX Proxy Manager (NPM), it is running within a docker container and the addon config only makes 3 ports available to configure (80, 81, 443), so you can map these elsewhere, but cannot add others.

However, I’m not clear on why you want to use NPM in conjunction with Cloudflared. I use both, but Cloudflared for external access and NPM for internal access.

1 Like

Thank you very much for your input! This definitely helped me with my issue and now I can access like anything from outside! I did not even know that you can map the hostname to the service since I just configured it to make it barely work back then.

If someone else comes across the same problem and wonders about the missing password security that comes along if you are using anything else than port 8123:
There are online services that lead to a password form before forwarding to the actual site you want to visit. So, if you want to access a site that does not have its own password form, you can still do it with these online services. It works pretty great for me.

About your question: I don’t know.
Yeah, that is not really a great answer. This happens if you want things to just work and follow along some online tutorials while not thinking much about what you are doing and if there may be a better way to do it.
It was meant to catch the traffic from site1.mydomain.com and forward it to homeassistant.local:8123. Since it worked and I did not know about any alternatives, I have not questioned it.
I think that your solution also can be achieved within NPM. To learn a little bit, what would be the pros and cons about that way?
I thought about using site.domain.com:port while the site remains the same and only the port gets mapped to whatever port I am using since Home Assistant did that automatically if I used site.domain.com and it probably behaved like it is doing if you are accessing locally? Anyways, I know that this would not look nice and a separate subdomain looks more elegant. But would this work as well? Because right now I am curious about that although I like the subdomain idea more.