1
Fork 0
e11sync/pkgs/e11sync-caddyfile.nix

27 lines
533 B
Nix
Raw Normal View History

2024-01-15 11:57:36 +02:00
{
writeTextFile,
e11sync-static,
backendPort ? 8002,
2024-01-15 11:57:36 +02:00
}:
writeTextFile {
name = "e11sync-caddyfile";
2024-01-15 11:57:36 +02:00
text = ''
2024-01-28 22:47:10 +02:00
@addSlash path /static /blog /contact
route @addSlash {
redir {uri}/ 302
}
2024-01-26 13:48:24 +02:00
header /static/* Cache-Control "public, max-age=31536000, immutable"
2024-01-15 11:57:36 +02:00
2024-01-28 22:47:10 +02:00
@staticRoutes path /static/* /contact/* /blog/*
route @staticRoutes {
2024-01-15 11:57:36 +02:00
file_server * {
root ${e11sync-static}
precompressed br gzip
}
}
reverse_proxy http://127.0.0.1:${toString backendPort}
2024-01-15 11:57:36 +02:00
'';
}