39 lines
768 B
Nix
39 lines
768 B
Nix
{
|
|
writeTextFile,
|
|
e11sync-static,
|
|
backendPort ? 8002,
|
|
}:
|
|
writeTextFile {
|
|
name = "e11sync-caddyfile";
|
|
text = ''
|
|
@addSlash path /static /blog /contact
|
|
|
|
route @addSlash {
|
|
redir {uri}/ 302
|
|
}
|
|
|
|
header /static/* Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
@staticRoutes path /static/* /contact/* /blog/*
|
|
route @staticRoutes {
|
|
header {
|
|
Cross-Origin-Opener-Policy same-origin
|
|
Referrer-Policy same-origin
|
|
X-Content-Type-Options nosniff
|
|
X-Frame-Options DENY
|
|
|
|
-Last-Modified
|
|
}
|
|
file_server * {
|
|
root ${e11sync-static}
|
|
precompressed br gzip
|
|
}
|
|
}
|
|
|
|
route {
|
|
encode gzip
|
|
reverse_proxy http://127.0.0.1:${toString backendPort}
|
|
}
|
|
'';
|
|
}
|