Discovery zeigte: YunoHost reicht den Usernamen nicht als Header durch, sondern im signierten Cookie "yunohost.portal" (JWT, Claim "user"). Die Forward-Auth liest jetzt die Identitaet aus Header ODER Cookie - nur von der Proxy-Quell-IP akzeptiert. HS256-Signaturpruefung optional via TRUSTED_AUTH_JWT_SECRET (stdlib hmac, kein Dep). - config: trusted_auth_cookie / _cookie_claim / _jwt_secret - nginx-Vorlage + deploy/README: keine Identitaets-Header-Zeile mehr noetig; SSO-Schutz der Subdomain ist Pflicht (sonst Spoofing) - Tests: Cookie-Extraktion, Signaturpruefung, Proxy-IP-Trust Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
38 lines
1.6 KiB
Text
38 lines
1.6 KiB
Text
# Reverse-Proxy fuer die Voice-Assistant-Web-UI auf einem YunoHost-Server.
|
|
#
|
|
# Ziel: https://va.linix.de -> http://<GPU_BOX_LAN_IP>:8003 (Gateway im LAN)
|
|
# YunoHost terminiert TLS (Let's Encrypt) und schuetzt die Subdomain per SSO.
|
|
#
|
|
# Ablage auf dem YunoHost-Server (Beispiel):
|
|
# /etc/nginx/conf.d/va.linix.de.d/assistant.conf
|
|
# danach: nginx -t && systemctl reload nginx
|
|
#
|
|
# WICHTIG (Unterschied zu Ollama): WebSockets (/ws/voice, /ws/chat) brauchen die
|
|
# Upgrade-Header und einen langen read-timeout - sonst bricht der Mikrofon-Button.
|
|
|
|
# --- einmalig im http{}-Kontext (z. B. /etc/nginx/conf.d/websocket-upgrade.conf) ---
|
|
# map $http_upgrade $connection_upgrade {
|
|
# default upgrade;
|
|
# '' close;
|
|
# }
|
|
|
|
location / {
|
|
proxy_pass http://GPU_BOX_LAN_IP:8003; # <-- LAN-IP der GPU-Box eintragen
|
|
proxy_http_version 1.1;
|
|
|
|
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;
|
|
|
|
# WebSocket-Upgrade (zwingend fuer das Mikrofon):
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection $connection_upgrade;
|
|
proxy_read_timeout 3600s;
|
|
proxy_send_timeout 3600s;
|
|
|
|
# Identitaet: KEIN eigener Header noetig. YunoHost liefert den Usernamen im
|
|
# Cookie "yunohost.portal" (JWT, Claim "user"); Cookies werden hier ohnehin
|
|
# durchgereicht. Das Gateway liest den Cookie (TRUSTED_AUTH_COOKIE=yunohost.portal).
|
|
# Wichtig: die Subdomain MUSS per SSO geschuetzt sein (sonst Identitaets-Spoofing).
|
|
}
|