Using Nginx with VPN

  • Hi.

    I have libreelec running on raspberry pi4. I have installed home assistant via docker and also intalled the OpenVPN addon. My home assistant should be accessible from the internet using duckdns domain through Nginx reverse proxy.

    The problem I'm facing is whenever VPN is connected, I am unable to access home assistant from outside the network.

    I am hoping someone could provide me with a guide on the best way to set this up. How do I get Home assistant / nginx to bypass the VPN?



    Thank you.

  • Hi. Thanks for replying. I have not asked a question there because, while the settings allows for exception, docker isnt in the list.

    Im guessing there is some kind of network setting i could tweak to allow an independent connection to my docker

    Edited once, last by anand0412 (August 6, 2021 at 6:21 PM).

  • The default VPN confs used by most providers simply "route all traffic down tunnel" .. hence the issue. However, most containers are NAT'd on the local host so they only expose ports/services via the existing IP address/interface of the host. To fix this you'd need to run containers from anothre IP address/interface (can be a alias/virtual interface), and then fiddle with the routing rules in the VPN conf so that you only route all traffic for the main interface (excluding the container interface) down the tunnel.

  • The default VPN confs used by most providers simply "route all traffic down tunnel" .. hence the issue. However, most containers are NAT'd on the local host so they only expose ports/services via the existing IP address/interface of the host. To fix this you'd need to run containers from anothre IP address/interface (can be a alias/virtual interface), and then fiddle with the routing rules in the VPN conf so that you only route all traffic for the main interface (excluding the container interface) down the tunnel.

    Following your suggestion, i tried creating the nginx docker under macvlan with its own ip. While i can get external traffic to the nginx docker, nginx is unable to forward the connection to home assistant docker which is under host network. I read that macvlan behaves that way by design.

    Looks like i hit a dead end. Thanks for the help anyway