- server/: Express-API (Auth, Bootstrap, Tickets, Threads, Benutzerverwaltung, Codes) mit pg-Schema (11 Tabellen), idempotem Seed (50 Wohnungen, 552 Buchungen) - mp-db (PostgreSQL 16, Volume mp_pgdata) + mp-api im Compose-Stack, nginx proxiet /api/ an mp-api; deploy.sh baut API-Image auf dem Server - Frontend: Store laedt /api/bootstrap, Schreibzugriff async, kein localStorage mehr (ausser Theme), Ladebildschirm beim Session-Check, vite-Proxy fuer Dev - Rollenrechte serverseitig: Mieter nur eigene Wohnung (getestet, 403-Verweis) - Mail-Benachrichtigungen komplett serverseitig (server/src/mail.js) - beispieldaten.py schreibt server/seed/generated.json; Verwaltungs-Mail = axel@hocks.eu - E2E live verifiziert: Login, Scoping, Ticket + Zustellung (status=sent), Registrierung, Codes; Testdaten bereinigt; Doku nachgefuehrt
54 lines
1.7 KiB
Plaintext
54 lines
1.7 KiB
Plaintext
server {
|
||
listen 80;
|
||
server_name mieterportal.hocks.eu localhost _;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
gzip on;
|
||
gzip_types text/css application/javascript image/svg+xml application/json;
|
||
gzip_min_length 1024;
|
||
|
||
# HTML nie cachen (Assets sind hash-benannt → ein Reload genügt)
|
||
location = /index.html {
|
||
add_header Cache-Control "no-cache" always;
|
||
}
|
||
|
||
# Cache für gehashte Build-Assets
|
||
location /assets/ {
|
||
expires 30d;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
|
||
# Mail-API des Portals (Container mp-mail-api im selben Docker-Netz npm_default).
|
||
# Das Token kommt aus portal.env (envsubst beim Container-Start) und liegt
|
||
# NIE im Repo und NIE im Browser – der Endpunkt ist nur vom Server erreichbar.
|
||
location = /api/mail/send {
|
||
limit_except POST { deny all; }
|
||
proxy_pass http://mp-mail-api:8080/send;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Api-Token "${MAIL_API_TOKEN}";
|
||
proxy_set_header X-Request-Source mieterportal-nginx;
|
||
client_max_body_size 64k;
|
||
proxy_read_timeout 15s;
|
||
}
|
||
|
||
# Portal-API (Node/Express + PostgreSQL): Auth, Daten, Benachrichtigungen.
|
||
location /api/ {
|
||
proxy_pass http://mp-api:3000;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
|
||
client_max_body_size 256k;
|
||
proxy_read_timeout 30s;
|
||
}
|
||
|
||
# SPA-Fallback für React Router
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
|
||
add_header X-Content-Type-Options "nosniff" always;
|
||
add_header X-Frame-Options "DENY" always;
|
||
}
|