allow all origins for cors
This commit is contained in:
parent
a9210ca8ed
commit
152286eb92
@ -8,7 +8,7 @@ class Settings(BaseSettings):
|
|||||||
VERSION: str = "0.1.0"
|
VERSION: str = "0.1.0"
|
||||||
|
|
||||||
# CORS Configuration
|
# CORS Configuration
|
||||||
BACKEND_CORS_ORIGINS: list[str | AnyHttpUrl] = []
|
BACKEND_CORS_ORIGINS: list[str | AnyHttpUrl] = ['*']
|
||||||
|
|
||||||
@validator("BACKEND_CORS_ORIGINS", pre=True)
|
@validator("BACKEND_CORS_ORIGINS", pre=True)
|
||||||
def assemble_cors_origins(self, v: str | list[str]) -> list[str] | str:
|
def assemble_cors_origins(self, v: str | list[str]) -> list[str] | str:
|
||||||
|
1
main.py
1
main.py
@ -62,7 +62,6 @@ if settings.BACKEND_CORS_ORIGINS:
|
|||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=[str(origin) for origin in settings.BACKEND_CORS_ORIGINS],
|
allow_origins=[str(origin) for origin in settings.BACKEND_CORS_ORIGINS],
|
||||||
allow_credentials=True,
|
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user