Tech & GadgetsProjects & Hobbies

HTTPS for your home apps: the Synology reverse proxy

Give every app on your Synology a proper name and a trusted certificate, without opening it to the internet: reverse proxy, wildcard certificate, WebSocket.

By Georgios Tsimplidis4 min read

Once you run a few apps on your Synology, you end up with a list like this: 192.168.1.10:9443 for Portainer, :4000 for TeslaMate, :3000 for Grafana… and a browser warning on half of them. It works, but it’s ugly, it’s easy to mix up, and some apps behave badly without HTTPS.

The fix is built into DSM: the reverse proxy. After this guide, the same apps open as https://teslamate.example.com and https://grafana.example.com, with a padlock and no warnings. And they’re still reachable only from home or through your VPN.

This is part two of a small series. Part one was Portainer on a Synology.

What a reverse proxy does

Picture the doorman of a hotel. Guests don’t need to know which floor or room you’re on: they say your name at the door, and the doorman walks them to the right room.

The reverse proxy is that doorman. Your browser asks for teslamate.example.com on the normal HTTPS port, 443. The NAS looks at the name, unlocks the connection with the certificate, and passes it inside to the app on port 4000. The app doesn’t need to know anything about certificates; the doorman handles them for every app at once.

What you need

  • A domain name for your NAS, with a wildcard certificate: one certificate that covers every name under it, like *.example.com. In DSM you can get one free through Let’s Encrypt, for example with a Synology DDNS name (yourname.synology.me) or your own domain. I use a wildcard certificate on my Synology, the same one I described in Talos lives in my hallway.
  • The apps already running, for example TeslaMate on port 4000 and its Grafana on port 3000.
  • DSM 7.2 or newer.

Step 1: make the names point to your NAS

Your browser has to find teslamate.example.com. Two ways:

  • Local DNS on your router. Many routers, UniFi included, let you add local DNS records: teslamate.example.com → 192.168.1.10. The name works at home, and through a VPN that uses your router for DNS.
  • A public DNS record pointing to the private address. At your domain’s DNS provider, point *.example.com (or each name) to your NAS’s local IP, 192.168.1.10. That address means nothing on the internet, so nobody outside can reach it; at home and through your VPN, it works everywhere.

Either way: don’t forward port 443 on your router. That’s what keeps all of this private.

Step 2: create the reverse proxy rule

  1. Open Control Panel → Login Portal → Advanced → Reverse Proxy.
  2. Click Create and fill in:
    • Reverse Proxy Name: TeslaMate
    • Source: protocol HTTPS, hostname teslamate.example.com, port 443. Tick Enable HSTS if you like: browsers will then always use HTTPS for this name.
    • Destination: protocol HTTP, hostname localhost, port 4000.
  3. Open the Custom Header tab, click Create → WebSocket. DSM adds the two headers apps need for live updates. TeslaMate’s live view, for example, freezes without them.
  4. Click Save.

Repeat for every app. For TeslaMate’s dashboards: name Grafana, source grafana.example.com on 443, destination localhost port 3000, WebSocket headers too.

Step 3: give the rules the wildcard certificate

  1. Open Control Panel → Security → Certificate.
  2. Click Settings.
  3. Find your new names (teslamate.example.com, grafana.example.com) in the list and choose your wildcard certificate for each.
  4. Click OK.

Open https://teslamate.example.com. Padlock, no warning. Done.

Step 4: tell the app its new address

Some apps build links to themselves and need to know their address. In TeslaMate: Settings → URLs, set the Web App to https://teslamate.example.com and Dashboards to https://grafana.example.com. Otherwise the buttons that jump to the dashboards still point at the old IP and port.

Keep the old door as a spare

I use both: the nice names through the reverse proxy, and the plain IP and port as a fallback. If DNS or the certificate ever has a bad day, http://192.168.1.10:4000 still works on the home network.

Common problems

  • “This site can’t be reached”: the name doesn’t point to your NAS. Check step 1, and whether your device (or VPN) uses the DNS server that knows the name.
  • The public DNS record doesn’t resolve at home: some routers block public names that point to private addresses (“DNS rebinding protection”). Allow your domain in the router’s settings, or use a local DNS record instead.
  • Certificate warning: the rule still uses the default certificate. Check step 3.
  • The page loads but nothing updates, or it keeps reconnecting: the WebSocket headers are missing. Check step 2, point 3.
  • 502 Bad Gateway: the app behind the doorman isn’t running, or the port is wrong. Check the container in Portainer.

Why not just open it to the internet?

Because it isn’t necessary, and every app you expose is a door someone can try. Even the TeslaMate project recommends a VPN rather than opening it up, because your car’s access tokens are behind it. With a VPN like WireGuard you get the same convenience from anywhere, and the doors stay locked.

Your apps, your data, your network. That’s the idea of the whole home server, and why I wrote about the numbers behind it in Dare, then calculate.

What’s next