diff --git a/README.md b/README.md index ed92bfc..e692e8f 100644 --- a/README.md +++ b/README.md @@ -122,12 +122,12 @@ When ExcaliDash runs behind Traefik, Nginx, or another reverse proxy, configure - `BACKEND_URL` (frontend) tells the Nginx container how to reach the backend from inside Docker/Kubernetes. Override it if your reverse proxy exposes the backend under a different hostname. ```yaml -frontend: - environment: - - BACKEND_URL=excalidash-backend.default.svc.cluster.local:8000 backend: environment: - FRONTEND_URL=https://excalidraw.example.com +frontend: + environment: + - BACKEND_URL=excalidash-backend.default.svc.cluster.local:8000 ``` # Development diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 9042f03..93821c2 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -30,8 +30,6 @@ RUN apk add --no-cache gettext # Copy nginx config template (will be processed at runtime) COPY frontend/nginx.conf.template /etc/nginx/nginx.conf.template -# Also copy the original as fallback -COPY frontend/nginx.conf /etc/nginx/nginx.conf # Copy entrypoint script COPY frontend/docker-entrypoint.sh /docker-entrypoint.sh diff --git a/frontend/docker-entrypoint.sh b/frontend/docker-entrypoint.sh index 67e5740..59719a3 100644 --- a/frontend/docker-entrypoint.sh +++ b/frontend/docker-entrypoint.sh @@ -10,6 +10,8 @@ echo "Configuring nginx with BACKEND_URL: ${BACKEND_URL}" # Only substitute BACKEND_URL, preserve nginx variables like $http_upgrade envsubst '${BACKEND_URL}' < /etc/nginx/nginx.conf.template > /etc/nginx/nginx.conf -# Execute the main command (nginx) -exec "$@" +# Validate the generated nginx configuration before starting +nginx -t -c /etc/nginx/nginx.conf +# Execute the main command (nginx) +exec "$@" \ No newline at end of file diff --git a/frontend/nginx.conf.template b/frontend/nginx.conf.template index 596d19b..281b701 100644 --- a/frontend/nginx.conf.template +++ b/frontend/nginx.conf.template @@ -27,7 +27,7 @@ http { proxy_pass http://${BACKEND_URL}/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection 'upgrade'; + proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; @@ -71,5 +71,4 @@ http { add_header Cache-Control "public, immutable"; } } -} - +} \ No newline at end of file