e11sync

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | LICENSE

e11sync-caddyfile.nix (900B) - Raw


      1 {
      2   writeTextFile,
      3   e11sync-static,
      4   backendPort ? 8002,
      5 }:
      6 writeTextFile {
      7   name = "e11sync-caddyfile";
      8   text = ''
      9     @addSlash path /static /blog /contact
     10     route @addSlash {
     11       redir {uri}/ 302
     12     }
     13 
     14     header /static/* Cache-Control "public, max-age=31536000, immutable"
     15 
     16     header {
     17       Content-Security-Policy "default-src 'none'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; script-src 'self'; frame-ancestors 'none'"
     18       Cross-Origin-Opener-Policy same-origin
     19       Referrer-Policy same-origin
     20       X-Content-Type-Options nosniff
     21 
     22       -X-Frame-Options
     23       -Last-Modified
     24     }
     25 
     26     @staticRoutes path /static/* /contact/* /blog/*
     27     route @staticRoutes {
     28       file_server * {
     29         root ${e11sync-static}
     30         precompressed br gzip
     31       }
     32     }
     33 
     34     route {
     35       encode gzip
     36       reverse_proxy http://127.0.0.1:${toString backendPort}
     37     }
     38   '';
     39 }