50 lignes
1.4 KiB
Caddyfile
50 lignes
1.4 KiB
Caddyfile
# =============================================================
|
|
# Caddy — le plus simple : compression + HTTPS automatiques
|
|
# Lancer : caddy run --config Caddyfile
|
|
# =============================================================
|
|
|
|
# Remplace par ton domaine (ex: gastinel.me) pour un HTTPS auto.
|
|
# Pour un test local, garde :8080
|
|
:8080 {
|
|
root * /srv/site
|
|
file_server
|
|
|
|
# Brotli si dispo, sinon gzip. S'applique au HTML/CSS/JS.
|
|
encode zstd gzip
|
|
|
|
# Assets versionnés par leur contenu -> cache très long.
|
|
@assets path /assets/*
|
|
header @assets Cache-Control "public, max-age=31536000, immutable"
|
|
|
|
# Le HTML doit toujours être revalidé (sinon tes mises à jour
|
|
# ne parviennent jamais aux visiteurs déjà venus).
|
|
@html path *.html /
|
|
header @html Cache-Control "no-cache"
|
|
|
|
# Télémétrie système : reverse-proxy sécurisé vers le démon local (GET uniquement)
|
|
@stats {
|
|
method GET
|
|
path /api/stats /api/stats/
|
|
}
|
|
handle @stats {
|
|
reverse_proxy 127.0.0.1:8085
|
|
header Cache-Control "public, max-age=2"
|
|
}
|
|
|
|
# Assistant légal Groq : reverse-proxy vers le démon local (POST et OPTIONS)
|
|
@assistant {
|
|
method POST OPTIONS
|
|
path /api/assistant /api/assistant/
|
|
}
|
|
handle @assistant {
|
|
reverse_proxy 127.0.0.1:8085
|
|
header Cache-Control "no-store, no-cache, must-revalidate"
|
|
}
|
|
|
|
header {
|
|
X-Content-Type-Options nosniff
|
|
Referrer-Policy strict-origin-when-cross-origin
|
|
-Server
|
|
}
|
|
}
|