From 19686e7866bdb66a601b10694164783e2b8b90df Mon Sep 17 00:00:00 2001 From: andersonid Date: Mon, 29 Sep 2025 17:50:20 -0300 Subject: [PATCH] Fix: adicionado CORS e corrigido endpoint cluster-health --- app/main.py | 10 ++++++++++ app/static/index.html | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index a049a66..a6a0f2a 100644 --- a/app/main.py +++ b/app/main.py @@ -7,6 +7,7 @@ import logging from fastapi import FastAPI, HTTPException, Depends from fastapi.staticfiles import StaticFiles from fastapi.responses import HTMLResponse +from fastapi.middleware.cors import CORSMiddleware from contextlib import asynccontextmanager from app.core.config import settings @@ -50,6 +51,15 @@ app = FastAPI( lifespan=lifespan ) +# Add CORS middleware +app.add_middleware( + CORSMiddleware, + allow_origins=["*"], # Allow all origins + allow_credentials=True, + allow_methods=["*"], # Allow all methods + allow_headers=["*"], # Allow all headers +) + # Include API routes app.include_router(api_router, prefix="/api/v1") diff --git a/app/static/index.html b/app/static/index.html index 40b390c..9fef017 100644 --- a/app/static/index.html +++ b/app/static/index.html @@ -1654,7 +1654,7 @@ hideMessages(); try { - const response = await fetch('/api/v1/cluster/status'); + const response = await fetch('/api/v1/cluster-health'); if (!response.ok) { throw new Error(`HTTP ${response.status}: ${response.statusText}`); }