2024-01-15 11:57:36 +02:00
|
|
|
{
|
|
|
|
writeTextFile,
|
|
|
|
e11sync-static,
|
2024-01-15 16:14:46 +02:00
|
|
|
backendPort ? 8002,
|
2024-01-15 11:57:36 +02:00
|
|
|
}:
|
|
|
|
writeTextFile {
|
2024-01-20 14:10:33 +02:00
|
|
|
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
|
2024-01-28 22:59:17 +02:00
|
|
|
|
2024-01-28 22:47:10 +02:00
|
|
|
route @addSlash {
|
2024-01-28 22:59:17 +02:00
|
|
|
redir {uri}/ 302
|
2024-01-28 22:47:10 +02:00
|
|
|
}
|
|
|
|
|
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-28 23:11:46 +02:00
|
|
|
header {
|
|
|
|
Cross-Origin-Opener-Policy same-origin
|
|
|
|
Referrer-Policy same-origin
|
|
|
|
X-Content-Type-Options nosniff
|
|
|
|
X-Frame-Options DENY
|
|
|
|
|
|
|
|
-Last-Modified
|
|
|
|
}
|
2024-01-15 11:57:36 +02:00
|
|
|
file_server * {
|
|
|
|
root ${e11sync-static}
|
|
|
|
precompressed br gzip
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-28 22:59:17 +02:00
|
|
|
route {
|
|
|
|
encode gzip
|
|
|
|
reverse_proxy http://127.0.0.1:${toString backendPort}
|
|
|
|
}
|
2024-01-15 11:57:36 +02:00
|
|
|
'';
|
|
|
|
}
|