mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 13:12:24 +00:00
Fix cookie expiration time zone (#408)
* Fix cookie expiration time zone * Fix the loss of cross-domain cookies
This commit is contained in:
@@ -209,11 +209,12 @@ def register_exception(app: FastAPI):
|
||||
if settings.MIDDLEWARE_CORS:
|
||||
|
||||
@app.exception_handler(StandardResponseCode.HTTP_500)
|
||||
async def cors_status_code_500_exception_handler(request, exc):
|
||||
async def cors_custom_code_500_exception_handler(request, exc):
|
||||
"""
|
||||
跨域 500 异常处理
|
||||
跨域自定义 500 异常处理
|
||||
|
||||
`Related issue <https://github.com/encode/starlette/issues/1175>`_
|
||||
`Solution <https://github.com/fastapi/fastapi/discussions/7847#discussioncomment-5144709>`_
|
||||
|
||||
:param request:
|
||||
:param exc:
|
||||
@@ -244,7 +245,7 @@ def register_exception(app: FastAPI):
|
||||
if origin:
|
||||
cors = CORSMiddleware(
|
||||
app=app,
|
||||
allow_origins=['*'],
|
||||
allow_origins=settings.CORS_ALLOWED_ORIGINS,
|
||||
allow_credentials=True,
|
||||
allow_methods=['*'],
|
||||
allow_headers=['*'],
|
||||
|
||||
Reference in New Issue
Block a user