From daa28cad7c5114a966c949775d03f4fcee9834e5 Mon Sep 17 00:00:00 2001 From: Evgeny Kolyakov Date: Thu, 14 Aug 2025 16:40:34 +0300 Subject: [PATCH] Added CORS --- ton-http-api/pyTON/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ton-http-api/pyTON/main.py b/ton-http-api/pyTON/main.py index e5f726a..6163be6 100644 --- a/ton-http-api/pyTON/main.py +++ b/ton-http-api/pyTON/main.py @@ -16,6 +16,7 @@ from fastapi import FastAPI, Depends, Response, Request, BackgroundTasks from fastapi.params import Body, Query, Param from fastapi.exceptions import HTTPException, RequestValidationError +from fastapi.middleware.cors import CORSMiddleware from starlette.exceptions import HTTPException as StarletteHTTPException from fastapi.responses import JSONResponse from fastapi import status @@ -113,6 +114,14 @@ def main_config(binder): openapi_tags=tags_metadata ) +app.add_middleware( + CORSMiddleware, + allow_credentials=True, + allow_origins=["*"], + allow_methods=["*"], + allow_headers=["*"], +) + tonlib = None