From 1e9506470f98d5948e8fc3da5252458189f3f9dc Mon Sep 17 00:00:00 2001 From: ZProger Date: Wed, 2 Sep 2026 02:01:15 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20/api/docs=20=D0=B2=D0=BE=D0=B7=D0=B2?= =?UTF-8?q?=D1=80=D0=B0=D1=89=D0=B0=D0=BB=20404=20=D0=B2=D0=BC=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=BE=20Swagger=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FastAPI регистрировал встроенные роуты документации на дефолтных путях (/docs, /openapi.json), в то время как все остальные роуты подключены с префиксом /api и только его проксирует nginx. Теперь docs_url/redoc_url/ openapi_url явно указаны под /api, поэтому Swagger UI доступен там же, где его и ищут (как заявлено в README). --- backend/app/main.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/backend/app/main.py b/backend/app/main.py index 1f1bdac..14e00ec 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -38,7 +38,18 @@ async def lifespan(app: FastAPI): yield -app = FastAPI(title="Aurum API", version=APP_VERSION, lifespan=lifespan) +app = FastAPI( + title="Aurum API", + version=APP_VERSION, + lifespan=lifespan, + # Docs live under /api/* because nginx only proxies that prefix to the + # backend (see frontend/nginx.conf) — everything else falls through to + # the SPA's index.html, which is why the defaults (/docs, /openapi.json) + # would silently 404 through the reverse proxy. + docs_url="/api/docs", + redoc_url="/api/redoc", + openapi_url="/api/openapi.json", +) # CORS stays off unless someone deliberately opens it, and credentials are # only granted to a pinned list. Starlette answers a credentialed "*" by