Refactor nginx configuration and update README
- Moved BACKEND_URL configuration to the frontend service in the README. - Added validation for the generated nginx configuration in the entrypoint script. - Removed fallback nginx configuration copy from the Dockerfile. - Adjusted nginx template to ensure proper header formatting. This improves the deployment process and clarifies configuration instructions.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 "$@"
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user