Skip to content
Snippets Groups Projects
Commit 30e5648c authored by Sourabh Desai's avatar Sourabh Desai
Browse files

cors

parent 638f089c
No related branches found
No related tags found
No related merge requests found
import os
from enum import Enum
from typing import List, Union, Optional
from typing import List, Union, Optional, Literal
from pydantic_settings import BaseSettings, SettingsConfigDict
from pydantic import AnyHttpUrl, EmailStr, field_validator
......@@ -70,7 +70,7 @@ class Settings(PreviewPrefixedSettings):
# BACKEND_CORS_ORIGINS is a JSON-formatted list of origins
# e.g: '["http://localhost", "http://localhost:4200", "http://localhost:3000", \
# "http://localhost:8080", "http://local.dockertoolbox.tiangolo.com"]'
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = []
BACKEND_CORS_ORIGINS: List[AnyHttpUrl | Literal["*"]] = []
@property
def VERBOSE(self) -> bool:
......
......@@ -110,7 +110,7 @@ if settings.BACKEND_CORS_ORIGINS:
# allow all origins
app.add_middleware(
CORSMiddleware,
allow_origins=origins,
allow_origins=[str(origin) for origin in origins],
allow_origin_regex="https://llama-app-frontend.*\.vercel\.app",
allow_credentials=True,
allow_methods=["*"],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment