INNER CODE UNIT · Python
dispatch
Chanchaldhiman/CANviz · backend/canviz/server.py:59
async def dispatch(self, request: Request, call_next) -> Response:
response = await call_next(request)
response.headers["Cross-Origin-Opener-Policy"] = "same-origin"
response.headers["Cross-Origin-Embedder-Policy"] = "require-corp"
return response
# Allow the React dev server (port 5173) and the bundled UI (same origin)
app.add_middleware(
CORSMiddleware,
allow_origins=[
"http://localhost:5173",
"http://127.0.0.1:5173",
"http://localhost:8080",
],
allow_methods=["*"],
allow_headers=["*"],
)