Skip to content

Adding CORSMiddleware #742

Answered by vincentsarago
nikkopante asked this question in Q&A
Jul 26, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

@nikkopante by default, the StacApi will already add a CORSMiddleware

middlewares: List[Middleware] = attr.ib(
default=attr.Factory(
lambda: [
Middleware(BrotliMiddleware),
Middleware(CORSMiddleware),
Middleware(ProxyHeaderMiddleware),
]
)
)
so you code will effectively have two cors middleware.

try

from starlette.middleware import Middleware

api = StacApi(
    settings=settings,
    extensions=extensions,
    client=CoreCrudClient(post_request_model=post_request_model),  # type: ignore
    response_class=ORJSONResponse,
    items_get_request_model=it…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by nikkopante
Comment options

You must be logged in to vote
2 replies
@nikkopante
Comment options

@vincentsarago
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #741 on July 26, 2024 07:59.