cors fixes

This commit is contained in:
2026-06-16 16:52:01 +05:30
parent eb845c5bf4
commit 8299445b68
9 changed files with 120 additions and 32 deletions

View File

@@ -27,6 +27,7 @@ Example:
from openapi_first.app import OpenAPIFirstApp
from starlette_csrf import CSRFMiddleware
import routes
app = OpenAPIFirstApp(
@@ -34,3 +35,13 @@ app = OpenAPIFirstApp(
routes_module=routes,
title="Health Check Service",
)
app.add_middleware(
CSRFMiddleware,
secret="change-me-in-production",
cookie_name="csrftoken",
header_name="x-csrftoken",
cookie_secure=False,
cookie_httponly=False,
cookie_samesite="lax",
)