INNER CODE UNIT · Python
_expand_dev_cors_origins
skygazer42/MimirQ · app/main.py:121
def _expand_dev_cors_origins(origins: list[str]) -> list[str]:
"""
Dev-friendly CORS: add localhost/IP aliases for local FE ports.
This prevents common UX issues when the frontend is opened via:
- http://0.0.0.0:3000 (Next dev prints this by default)
- http://127.0.0.1:3000
- http://127.0.0.1:3100 (Playwright local prod-server checks)
while backend env only allows http://localhost:3000.
"""
if not origins:
return origins
if "*" in origins:
return origins
expanded = {origin for raw in origins if (origin := _normalize_dev_origin(raw))}
local_schemes: set[str] = set()