ingress #1
62
cookcli/rootfs/etc/nginx/nginx.conf
Normal file
62
cookcli/rootfs/etc/nginx/nginx.conf
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
|
||||
# Logs pour debugging
|
||||
access_log /proc/1/fd/1;
|
||||
error_log /proc/1/fd/2;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_vary on;
|
||||
gzip_proxied any;
|
||||
gzip_types text/plain text/css text/xml text/javascript application/json application/javascript application/xml+rss application/rss+xml;
|
||||
|
||||
# Configuration du serveur
|
||||
server {
|
||||
listen 9080;
|
||||
server_name localhost;
|
||||
|
||||
# Taille maximale des fichiers
|
||||
client_max_body_size 10M;
|
||||
|
||||
# Headers pour l'Ingress
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
|
||||
# Headers spécifiques à Home Assistant Ingress
|
||||
proxy_set_header X-Ingress-Path $request_uri;
|
||||
proxy_set_header X-Forwarded-Prefix "/api/hassio_ingress/$(HASSIO_TOKEN)";
|
||||
|
||||
# Désactiver le buffering pour les logs en temps réel
|
||||
proxy_buffering off;
|
||||
|
||||
# Proxy vers CookCLI
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:9081;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
# Réécriture des URLs pour l'Ingress
|
||||
sub_filter_once off;
|
||||
sub_filter_types text/html text/css application/javascript;
|
||||
sub_filter 'href="/' 'href="$scheme://$host/';
|
||||
sub_filter 'src="/' 'src="$scheme://$host/';
|
||||
sub_filter 'action="/' 'action="$scheme://$host/';
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue