I have an openwrt router at home which also acts as my home server. It’s running a bunch of services using docker (Jellyfin, Nextcloud, etc.)

I have set up an SSH tunnel between my openwrt router and VPS and can access jellyfin successfully.

I understand that I need to set up a reverse proxy to access multiple services and have https.

But I’m confused if I should set up this reverse proxy on the VPS or on the router itself. Is nginx the easiest option? Should i add subdomains in cloudflare for every service?

Pease don’t recommend vpns since they are all blocked where i live (wireguard, tailscale openVPN, etc.) I’m limited to using ssh tunneling only.

Thanks

  • lemmyvore@feddit.nl
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    There are pros and cons to keeping the proxy on the VPS or at home.

    If you keep it at home you will have end-to-end encryption from the browser to your home server. Downside, you will not get the IP of the remote client, just the IP of the router, so you won’t be able to do IP blocking or diagnostics.

    By putting the proxy on the VPS and decrypting HTTPS there you can add remote IPs to connections but you have to keep the TLS certificate on the VPS so in theory someone could mess with it.

    A third option is to run a minimal passthrough proxy on the VPS that adds the remote IP to the HTTPS connections without decrypting them. To do this you must use the same proxy at both ends (home and VPS) and both must have the PROXY protocol enabled.

    I would suggest doing just proxy at home to start with because it’s simpler. If you want a GUI use NPM (Nginx Proxy Manager) it’s super easy. If you prefer a proxy where you write config by hand use Caddy.

    After you have it working at home you can consider adding the one on VPS and enabling the PROXY protocol. Although I’m not 100% sure Caddy supports it, look into it. You may have to use Nginx in both places I’d it doesn’t.

    You do not need to add subdomains in DNS, not unless you want to. You just need one domain to point an A/AAAA record at the VPS public IP, then you can make the subdomains a wildcard CNAME pointing at the base domain. So A/AAAA example.com -> IP, and CNAME *.example.com -> example.com. Or you can put the A in another domain and point the CNAME at that.

    When requesting TLS certificates it’s the same thing, you never ask for explicit certificates for each subdomain, you just ask for one wildcard certificate for *.example.com. Aside from the obvious benefit of not having to add and remove certificates every time you add or remove subdomains, there’s the not obvious benefit of not having bots learn about your subdomains (certificate application are public records).

    The subdomains do not need to resolve in DNS for this to work, the certbot verifies that you own the domain by using a DNS API key to create a temporary TXT on example.com; as long as that works it won’t care what’s actually defined in there.