summaryrefslogtreecommitdiff
path: root/nixos/sites/catbus-web-ui.nix
blob: c68cdcf1d926fb0ac0036571c99f52a0701c1b63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{ pkgs }:

{ mosquittoHost, mosquittoPort }: {
  locations = {
    "/" = {
      root = "${pkgs.eth.catbus-web-ui}";
    };

    "/mqtt" = {
      proxyPass = "http://${mosquittoHost}:${toString mosquittoPort}";
      proxyWebsockets = true;
      extraConfig = ''
        rewrite ^/mqtt$ / break;
        rewrite ^/mqtt(.*)$ $1 break;
      '';
    };
  };
}