summaryrefslogtreecommitdiff
path: root/hosts/ahmed/syncthing/reverse-proxy.nix
blob: e6b84c0e60dd65e24274d0fd0bfff5c4869db3af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{config, ...}: {
  # Use NGINX as a reverse proxy.
  # See: https://docs.syncthing.net/users/reverseproxy.html
  services.nginx = {
    virtualHosts."syncthing.${config.linus.local-dns.domain}" = {
      locations."/" = {
        proxyPass = "http://${config.services.syncthing.guiAddress}";
        recommendedProxySettings = true;
      };
    };
  };

  # By default Syncthing checks that the Host header says "localhost" which
  # will not be the case when using a reverse proxy.
  #
  # See: https://docs.syncthing.net/users/faq.html#why-do-i-get-host-check-error-in-the-gui-api
  services.syncthing.settings.gui = {
    insecureSkipHostcheck = true;

    user = "linus";
    password = "$y$j9T$mLlnLvW2XHNH3xlL0Vlnr1$Aa1tc2/c0qAKkp/5yt0F7dBD8pSjzqwgAIL4bZ/sAa9";
  };

  linus.local-dns.subdomains = ["syncthing"];
}