From d25514c6dc33ea91ce3436cbddd69ad877d31c5f Mon Sep 17 00:00:00 2001 From: Muskankr Date: Mon, 13 Jul 2026 11:21:18 +0530 Subject: [PATCH] Restrict Flask-CORS to frontend domain --- backend/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/__init__.py b/backend/__init__.py index c6077fd..7cd4d05 100644 --- a/backend/__init__.py +++ b/backend/__init__.py @@ -1,2 +1,12 @@ # intentionally left empty — makes backend a package for making -# it as importable from the outside \ No newline at end of file +# it as importable from the outside + +from flask import Flask +from flask_cors import CORS + +app = Flask(__name__) + +# Restrict CORS to your deployed frontend domain +CORS(app, resources={ + r"/api/*": {"origins": "https://your-frontend.example.com"} +})