Skip to content

[Feature Request] Add CORS middleware #131

@rambo

Description

@rambo

RegEx to match the current deployment

rm_base = "https://replaceme.example.org" # FIXME read url from manifest
deployment_domain_regex = rm_base.replace(".", r"\.").replace("https://", r"https://(.*\.)?")
LOGGER.info("deployment_domain_regex={}".format(deployment_domain_regex))

app = FastAPI(docs_url="/api/docs", openapi_url="/api/openapi.json", version=__version__)
app.add_middleware(
    CORSMiddleware,
    allow_origin_regex=deployment_domain_regex,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions