Skip to content

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

Add the WEB_APP_ORIGIN_URL in to the cors (#1207)

Ritwik G72f5d75f34a1
diff --git a/backend/backend/settings/base.py b/backend/backend/settings/base.py
index 9e0ae7e2a..188f82647 100644
--- a/backend/backend/settings/base.py
+++ b/backend/backend/settings/base.py
@@ -58,6 +58,7 @@ WORKFLOW_ACTION_EXPIRATION_TIME_IN_SECOND = os.environ.get(
"WORKFLOW_ACTION_EXPIRATION_TIME_IN_SECOND", 10800
)
WEB_APP_ORIGIN_URL = os.environ.get("WEB_APP_ORIGIN_URL", "http://localhost:3000")
+CORS_ALLOWED_ORIGINS = [WEB_APP_ORIGIN_URL]
LOGIN_NEXT_URL = os.environ.get("LOGIN_NEXT_URL", "http://localhost:3000/org")
LANDING_URL = os.environ.get("LANDING_URL", "http://localhost:3000/landing")
diff --git a/backend/backend/settings/dev.py b/backend/backend/settings/dev.py
index 8765cd234..5a0b81650 100644
--- a/backend/backend/settings/dev.py
+++ b/backend/backend/settings/dev.py
@@ -1,27 +1,19 @@
-from backend.settings.base import * # noqa: F401, F403
+from backend.settings.base import * # noqa: F403
DEBUG = True
X_FRAME_OPTIONS = "http://localhost:3000"
X_FRAME_OPTIONS = "ALLOW-FROM http://localhost:3000"
-CORS_ALLOWED_ORIGINS = [
+# Ensure it's defined before modifying
+try:
+ CORS_ALLOWED_ORIGINS # noqa: F405
+except NameError:
+ CORS_ALLOWED_ORIGINS = [] # Define it if not present
+# Add to the CORS_ALLOWED_ORIGINS from base
+CORS_ALLOWED_ORIGINS = CORS_ALLOWED_ORIGINS + [
"http://localhost:3000",
"http://127.0.0.1:3000",
"http://frontend.unstract.localhost",
# Other allowed origins if needed
]
-
-CORS_ORIGIN_WHITELIST = [
- "http://localhost:3000",
- "http://127.0.0.1:3000",
- "http://frontend.unstract.localhost",
- # Other allowed origins if needed
-]
-
-CORS_ALLOW_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"]
-
-CORS_ALLOW_HEADERS = [
- "authorization",
- "content-type",
-]