summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2026-05-01 15:42:26 +0800
committeraltaf-creator <dev@altafcreator.com>2026-05-01 15:42:26 +0800
commitc0acd00b421322c34b644cfb4b8be19e7a7838fa (patch)
treedec6f946dca680ff7e8700ef01723f4bcf4d1d93 /backend
parent58b54e84673031c1c9bec860b54cf736512b485c (diff)
backend CORS
Diffstat (limited to 'backend')
-rw-r--r--backend/main.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/backend/main.py b/backend/main.py
index 97481b6..a5faf36 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -1,4 +1,5 @@
import fastapi
+from fastapi.middleware.cors import CORSMiddleware
import requests
from dotenv import load_dotenv
from os import getenv
@@ -9,6 +10,19 @@ load_dotenv()
app = fastapi.FastAPI(title="altafcreator.com", decscription="altafcreator.com API", version="1.0")
TURNSTILE_SECRET = getenv("CLOUDFLARE_TURNSTILE_SECRET").encode("utf-8")
+origins = [
+ "http://localhost",
+ "https://altafcreator.com",
+ "https://backend.altafcreator.com"
+]
+app.add_middleware(
+ CORSMiddleware,
+ allow_origins=origins,
+ allow_credentials=True,
+ allow_methods=["*"],
+ allow_headers=["*"],
+)
+
@app.post("/email")
def email(token):