CORS
About 124 wordsLess than 1 minute
When integrating frontend and backend projects or deploying to a server, you will often hit cross-origin issues. Just open backend/core/conf.py and update the CORS_ALLOWED_ORIGINS setting to resolve CORS-related problems.
Local
CORS_ALLOWED_ORIGINS: list[str] = [
'http://localhost:5173', # Frontend access URL, without trailing '/'
]Server
HTTP
CORS_ALLOWED_ORIGINS: list[str] = [
'http://server-ip:port', # Frontend access URL, without trailing '/'. When the port is 80, omit the port.
] HTTPS
CORS_ALLOWED_ORIGINS: list[str] = [
'https://domain', # Frontend access URL, without trailing '/'
]LAN
This depends on whether the frontend project is configured for LAN access.
CORS_ALLOWED_ORIGINS: list[str] = ['*']
