Initial commit: Visigine (Vite client + Express/SQLite backend)
Container-ready via docker/ compose (frontend nginx + backend Node). Compose adjusted for Coolify on the prod server: frontend uses expose:80 (no host binding — host 8080 is taken by the Coolify proxy; Traefik routes visigine.de), backend ALLOWED_ORIGINS=https://visigine.de. Secrets stay in server/.env (git-ignored); see server/.env.example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
49
docker/nginx.conf
Normal file
49
docker/nginx.conf
Normal file
@@ -0,0 +1,49 @@
|
||||
# Visigine — serves the static React build and reverse-proxies API to the
|
||||
# `backend` service over the docker network. Browser sees one origin, so no
|
||||
# CORS handshake is needed for /api/* calls.
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name _;
|
||||
|
||||
client_max_body_size 1m;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# SPA fallback so /admin, /impressum, /datenschutz hit React Router.
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# Cache hashed assets aggressively (Vite emits content-hashed filenames).
|
||||
location ~* \.(?:js|css|woff2?|svg|png|jpg|jpeg|gif|webp|ico)$ {
|
||||
try_files $uri =404;
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, immutable";
|
||||
}
|
||||
|
||||
# API → backend container.
|
||||
location /api/ {
|
||||
proxy_pass http://backend:3001;
|
||||
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;
|
||||
# Strip browser Origin so the backend treats this as same-origin and
|
||||
# skips its CORS allow-list check (we are the only ingress here).
|
||||
proxy_set_header Origin "";
|
||||
|
||||
# Analyses can take up to ~10s (fetcher timeout + Mistral call).
|
||||
proxy_read_timeout 30s;
|
||||
proxy_send_timeout 30s;
|
||||
}
|
||||
|
||||
# Pass-through health probe so `docker compose ps` shows useful state.
|
||||
location = /health {
|
||||
proxy_pass http://backend:3001/health;
|
||||
proxy_set_header Origin "";
|
||||
access_log off;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user