NgixProxy_Pathfinder/nginx/snippets/fingerprinting.conf

16 lines
717 B
Plaintext

# --- Pathfinder Static Asset Fingerprinting ---
# Permite o uso de 'Cache-Control: immutable' para arquivos com hash no nome.
# Lógica: Se o arquivo termina em .[hash].ext e não existir fisicamente,
# o Nginx tenta carregar o arquivo original (sem o hash).
# Ex: main.a1b2c3d4.js -> tenta main.js no backend/disco local.
location ~* "^(.+)\.[0-9a-f]{8,}\.(js|css|png|jpg|jpeg|gif|ico|svg|webp|avif|woff2?|wasm)$" {
# 1. Tenta o arquivo original se o versionado não existir
try_files $uri $1.$2 =404;
# 2. Força cache imutável (Já que o conteúdo muda se o nome mudar)
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Pathfinder-Cache "Immutable-Asset";
}