summaryrefslogtreecommitdiff
path: root/hosts/cloud/proxy/default.nix
blob: f72b77686751a01da453705578375c855b916c38 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ inputs, ... }:
let
  website = inputs.website;
in
{
  imports = [
    ./git.nix
  ];

  networking.firewall.allowedTCPPorts = [
    80
    443
  ];

  services.caddy = {
    enable = true;
    virtualHosts."oxapentane.com" = {
      serverAliases = [ "www.oxapentane.com" ];
      extraConfig = ''
        # conduit
        @matrix {
            path /.well-known/matrix/*
            path /_matrix/*
        }

        route {
            header /.well-known/matrix/* Access-Control-Allow-Origin *

            respond @matrix "This Matrix homeserver has been retired" 410

            # file server
            file_server {
                root ${website}
                index index.html
            }
        }
      '';
    };

    virtualHosts."auth.oxapentane.com".extraConfig = ''
      respond "Not Found" 404
    '';

    virtualHosts."idm.oxapentane.com".extraConfig = ''
      reverse_proxy https://10.89.88.20:8443 {
        transport http {
          tls_server_name idm.oxapentane.com
        }
      }
    '';

    virtualHosts."immich.oxapentane.com".extraConfig = ''
      reverse_proxy 10.89.88.13:2283
    '';

    virtualHosts."news.oxapentane.com".extraConfig = ''
      respond "Temporary unavailable due to maintenance" 503
    '';

    virtualHosts."music.oxapentane.com".extraConfig = ''
      respond "Temporary unavailable due to maintenance" 503
    '';

  };
}