CORS-Origins konfigurierbar machen für Production-Deployment #84

Open
opened 2026-03-30 20:21:08 +00:00 by David · 0 comments
Collaborator

Beschreibung

In backend/main.py:215-221 sind die CORS-Origins auf http://localhost:{frontend_port} hardcoded. In Production (anderer Host, HTTPS, Reverse Proxy) werden alle Frontend-Requests vom Browser geblockt.

Hintergrund

CORS ist ein Browser-Sicherheitsmechanismus. Wenn das Frontend auf https://bruno.example.com läuft aber CORS nur http://localhost:3000 erlaubt, funktioniert die Anwendung nicht.

Akzeptanzkriterien

  • Neue Config: CORS_ORIGINS als kommaseparierte Liste
  • Default: http://localhost:3000 (Abwärtskompatibel)
  • Wildcard * möglich aber mit Warnung im Log
  • HTTPS-Origins werden unterstützt
  • Test: Request von konfiguriertem Origin wird erlaubt

Technische Hinweise

  • Betroffene Dateien: backend/main.py, backend/config.py
  • Ansatz: cors_origins: str = "http://localhost:3000", Split auf ,
  • Migration nötig: nein

Aufwand: S

## Beschreibung In `backend/main.py:215-221` sind die CORS-Origins auf `http://localhost:{frontend_port}` hardcoded. In Production (anderer Host, HTTPS, Reverse Proxy) werden alle Frontend-Requests vom Browser geblockt. ## Hintergrund CORS ist ein Browser-Sicherheitsmechanismus. Wenn das Frontend auf `https://bruno.example.com` läuft aber CORS nur `http://localhost:3000` erlaubt, funktioniert die Anwendung nicht. ## Akzeptanzkriterien - [ ] Neue Config: `CORS_ORIGINS` als kommaseparierte Liste - [ ] Default: `http://localhost:3000` (Abwärtskompatibel) - [ ] Wildcard `*` möglich aber mit Warnung im Log - [ ] HTTPS-Origins werden unterstützt - [ ] Test: Request von konfiguriertem Origin wird erlaubt ## Technische Hinweise - Betroffene Dateien: `backend/main.py`, `backend/config.py` - Ansatz: `cors_origins: str = "http://localhost:3000"`, Split auf `,` - Migration nötig: nein ## Aufwand: S
Sign in to join this conversation.
No description provided.