fix: update CORS settings to allow all origins temporarily

This commit is contained in:
Artem Kashaev 2025-12-01 12:55:51 +05:00
parent ede064cc11
commit 4fe3d0480e
2 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,5 @@
"""FastAPI application factory.""" """FastAPI application factory."""
from __future__ import annotations from __future__ import annotations
from collections.abc import AsyncIterator from collections.abc import AsyncIterator
@ -13,9 +14,9 @@ from app.core.middleware.cache_monitor import CacheAvailabilityMiddleware
from fastapi.middleware.cors import CORSMiddleware from fastapi.middleware.cors import CORSMiddleware
def create_app() -> FastAPI: def create_app() -> FastAPI:
"""Build FastAPI application instance.""" """Build FastAPI application instance."""
@asynccontextmanager @asynccontextmanager
async def lifespan(_: FastAPI) -> AsyncIterator[None]: async def lifespan(_: FastAPI) -> AsyncIterator[None]:
await init_cache() await init_cache()
@ -29,7 +30,14 @@ def create_app() -> FastAPI:
application.add_middleware(CacheAvailabilityMiddleware) application.add_middleware(CacheAvailabilityMiddleware)
application.add_middleware( application.add_middleware(
CORSMiddleware, CORSMiddleware,
allow_origins=["https://kitchen-crm.k1nq.tech", "http://192.168.31.51"], allow_origins=[
# "https://kitchen-crm.k1nq.tech",
# "http://192.168.31.51",
# "http://localhost:8000",
# "http://0.0.0.0:8000",
# "http://127.0.0.1:8000",
"*" # ! TODO: Убрать
],
allow_credentials=True, allow_credentials=True,
allow_methods=["*"], # Разрешить все HTTP-методы allow_methods=["*"], # Разрешить все HTTP-методы
allow_headers=["*"], # Разрешить все заголовки allow_headers=["*"], # Разрешить все заголовки

View File

@ -82,7 +82,7 @@ define(['./workbox-c5fd805d'], (function (workbox) { 'use strict';
"revision": "d41d8cd98f00b204e9800998ecf8427e" "revision": "d41d8cd98f00b204e9800998ecf8427e"
}, { }, {
"url": "index.html", "url": "index.html",
"revision": "0.h29q0vck9ug" "revision": "0.nhqann807f"
}], {}); }], {});
workbox.cleanupOutdatedCaches(); workbox.cleanupOutdatedCaches();
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), { workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("index.html"), {