this post was submitted on 28 Jan 2024
10 points (91.7% liked)

Selfhosted

40173 readers
650 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

Hello, I have a question regarding the usage of a reverse-proxy which is part of a docker network.

I currently use Nginx Proxy Manager as a reverse-proxy for all my services hosted in docker. This works great since I can simply forward using each containers name. I have some services however (e.g. homeassistant) which are hosted separately in a VM or using docker on another device.

Is it possible to use the same reverse-proxy for those services as well? I haven't found a way to forward to hosts outside of the proxies docker network (except for using the host network setting which I would like to avoid)

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 5 points 9 months ago (7 children)

If the other services are exposed on local ports, you can have NPM forward to those.

[–] [email protected] 2 points 9 months ago (6 children)

By exposed you basically mean that I can reach them using my browser? I can reach my homeassistant web ui on port 8123 but when I try to forward to that port with the servers IP I get a 400 Bad Request error. I'm not sure if this is caused by nginx being unable to forward or by homeassistant not accepting the connection somehow

[–] [email protected] 9 points 9 months ago* (last edited 9 months ago) (3 children)

For homeassistant I had to add this in configuration.yaml

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.21.0.2

Where 172.21.0.2 is my NPM docker IP

Edit: its NPM IP and not HA like I wrote first time

[–] [email protected] 1 points 9 months ago (1 children)

Thanks. I tried it like this and still get a 400 Bad Request error.

Someone below mentioned adding some more IPs to the trusted_proxies list so I tried that as well without result. The IP I used for the reverse-proxy is the IP listed in portainer under the network for the proxy container. Just to reiterate, the container is running on a different device than homeassistant (technically same device but different VM but that shouldn't make a difference).

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 192.168.208.2 # IP of reverse-proxy in its network
    - 192.168.208.0/20 # Subnet of proxy docker network
    - 192.168.1.103 # HA IP
[–] [email protected] 1 points 9 months ago

My NPM window looks the same as yours. Im not sure mate, I would try disabling firewall just to see is that the problem. Im not expert in that area and nothing else comes to my mind sorry. Im also running everything under one host

load more comments (1 replies)
load more comments (3 replies)
load more comments (3 replies)