summary refs log tree commit diff
path: root/host/Rory-desktop/nginx/discord.localhost.nix
blob: 149d2b176593851120f851f0598f01cc7ac1a030 (plain) (blame)
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
{ pkgs, ... }:

{
  root = "/www/discord";
  addSSL = true;
  enableACME = false;

  # We don't care about certificates around here...
  sslCertificate = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem";
  sslCertificateKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem";
        

  extraConfig = ''
    autoindex on;
    more_set_headers 'Access-Control-Allow-Origin: *';
    more_set_headers 'Access-Control-Allow-Methods: GET, POST, OPTIONS';
    more_set_headers 'Access-Control-Allow-Headers: DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
    more_set_headers 'Access-Control-Expose-Headers: Content-Length,Content-Range';
    more_set_headers 'Access-Control-Allow-Credentials: true';
  '';

  locations = {
    "/" = {
      index = "index.html";
      extraConfig = ''
        more_set_headers 'Access-Control-Allow-Origin: *';
        more_set_headers 'Access-Control-Allow-Methods: *';
        more_set_headers 'Access-Control-Allow-Headers: *';
        more_set_headers 'Access-Control-Expose-Headers: *';
        more_set_headers 'Access-Control-Max-Age' 1728000;

        # default to /index.html if file not found
        try_files $uri $uri/ /index.html;
      '';
    };
  };
}