# ============================================================================ # nginx-rbac.conf.template — Config nginx pour l'intranet avec RBAC # ============================================================================ # Substitue __USER_EMAIL__ dans le HTML par la valeur du header X-Forwarded-Email # (envoyé par OAuth2-Proxy après authentification Zitadel). # ============================================================================ events {} http { server { listen 80; server_name _; root /usr/share/nginx/html; index index.html; # Cache désactivé pour l'HTML (sinon le sub_filter peut servir un email obsolète) location = /index.html { add_header Cache-Control "no-store, no-cache, must-revalidate"; # ⭐ Substitue __USER_EMAIL__ par la valeur du header HTTP sub_filter '__USER_EMAIL__' '$http_x_forwarded_email'; sub_filter_once off; sub_filter_types text/html; } # Pareil pour la racine / location = / { add_header Cache-Control "no-store, no-cache, must-revalidate"; sub_filter '__USER_EMAIL__' '$http_x_forwarded_email'; sub_filter_once off; sub_filter_types text/html; try_files /index.html =404; } # Le mapping JSON doit être accessible mais pas mis en cache location = /roles-mapping.json { add_header Cache-Control "no-store"; add_header Content-Type application/json; } # Logo et autres fichiers statiques location / { try_files $uri $uri/ =404; } } }