INNER CODE UNIT · Python
_expand_port_matrix
skygazer42/MimirQ · app/main.py:114
def _expand_port_matrix(expanded: set[str], schemes: set[str], ports: set[int]) -> None:
for scheme in sorted(schemes):
for port in sorted(ports | _DEV_LOCAL_CORS_PORTS):
for host in sorted(_LOCAL_DEV_HOSTS):
expanded.add(f"{scheme}://{host}:{port}")
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: