Add CORS support for frontend on localhost:3000
The frontend at http://localhost:3000 was getting CORS (Cross-Origin Resource Sharing) errors when trying to make API requests to http://localhost:8000. Added CORSMiddleware to FastAPI backend with: - allow_origins: http://localhost:3000 and http://127.0.0.1:3000 - allow_credentials: true (for Authorization headers) - allow_methods: all (GET, POST, OPTIONS, etc.) - allow_headers: all (including Authorization, Content-Type, etc.) This allows the browser to make cross-origin requests from the frontend to the API. CORS headers now properly returned: access-control-allow-origin: http://localhost:3000 access-control-allow-credentials: true Co-authored-by: Copilot <[email protected]>
This commit is contained in:
1 parent
78a73acec3
commit
186cd4cc7c
4 files changed
+10
No files matched your search
Binary file not shown.
Reference in new issue
Block a user