Docker: interner nginx statt socat (Host-Header -> localhost)

Ursache des 404 bei Zugriff über IP/Proxy: .NET-HttpListener bedient den Prefix
http://localhost:8077/ nur bei Host: localhost. socat (L4) reicht den originalen
Host-Header durch -> 404. Jetzt sitzt ein winziger nginx im Container davor, der
den Host-Header auf localhost umschreibt (Upstream [::1]:8077, IPv4 als Fallback).
App-Code bleibt unverändert.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-09-21 14:35:24 +02:00
co-authored by Claude Opus 4.8
parent c217f5f8f3
commit f40be6e4bd
5 changed files with 55 additions and 25 deletions
+5 -3
View File
@@ -5,10 +5,11 @@
# Env-Variablen bzw. das Entrypoint-Script - ohne Codeaenderung.
FROM mcr.microsoft.com/powershell:7.4-debian-12
# socat = Bridge 0.0.0.0:BRIDGE_PORT -> 127.0.0.1:APP_PORT (App bindet nur loopback).
# nginx = interner Reverse-Proxy, der den Host-Header auf "localhost" umschreibt
# (HttpListener-Prefix http://localhost:8077/ bedient nur Host: localhost).
# git = fuer das optionale Policy-Git-Snapshot-Feature.
RUN apt-get update \
&& apt-get install -y --no-install-recommends socat git ca-certificates \
&& apt-get install -y --no-install-recommends nginx git ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& pwsh -NoProfile -Command "Install-Module Microsoft.Graph.Authentication -Scope AllUsers -Force"
@@ -19,7 +20,8 @@ COPY Start.ps1 ./
COPY src/ ./src/
COPY www/ ./www/
# Entrypoint (neu, nur fuer den Container).
# Interner nginx-Reverse-Proxy (Host-Rewrite) + Entrypoint (neu, nur fuer Container).
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh