Actualiser cookcli/rootfs/etc/nginx/nginx.conf

This commit is contained in:
TheThomaas 2026-09-06 11:21:32 +00:00
parent 6d7d9be778
commit ab5b9f4d97

View file

@ -24,15 +24,49 @@ http {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port $server_port;
# Proxy simple vers CookCLI # Désactiver le buffering
proxy_buffering off;
# Proxy vers CookCLI
location / { location / {
proxy_pass http://127.0.0.1:9081; proxy_pass http://127.0.0.1:9081;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade"; proxy_set_header Connection "upgrade";
proxy_buffering off;
# --- RÉÉCRITURE DES URLs POUR L'INGRESS ---
# Capture le chemin Ingress depuis les headers
set $ingress_path $http_x_forwarded_prefix;
if ($ingress_path = "") {
set $ingress_path "";
}
# Sub_filter pour réécrire les URLs absolues
sub_filter_once off;
sub_filter_types text/html text/css application/javascript;
# Réécriture des URLs de base
sub_filter 'href="/' 'href="$ingress_path/';
sub_filter 'src="/' 'src="$ingress_path/';
sub_filter 'action="/' 'action="$ingress_path/';
# Réécriture spécifique pour les chemins courants
sub_filter '"/static/' '"$ingress_path/static/';
sub_filter '"/assets/' '"$ingress_path/assets/';
sub_filter '"/css/' '"$ingress_path/css/';
sub_filter '"/js/' '"$ingress_path/js/';
# Si l'application utilise des chemins relatifs, les forcer
sub_filter '<base href="/"' '<base href="$ingress_path/"';
# Gérer les redirections
proxy_redirect http://127.0.0.1:9081/ $scheme://$host$ingress_path/;
proxy_redirect http://127.0.0.1:9081 $scheme://$host$ingress_path;
} }
} }
} }