From dc5e79667ae6f4bafd5f5212ba372f1eba2998e4 Mon Sep 17 00:00:00 2001 From: vickytechkey Date: Sat, 3 Oct 2026 17:26:30 +0530 Subject: [PATCH] feat: add Django settings and update Nginx server names for production domains --- crmbackend.nginx.conf | 2 +- digihoxbackend/settings.py | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/crmbackend.nginx.conf b/crmbackend.nginx.conf index 2f6f351..9aa5dfd 100644 --- a/crmbackend.nginx.conf +++ b/crmbackend.nginx.conf @@ -1,6 +1,6 @@ server { listen 80; - server_name crmbackend.local; + server_name betaapicsa.tradhox.com apicsa.tradhox.com crmbackend.local; location / { proxy_pass http://127.0.0.1:8081; diff --git a/digihoxbackend/settings.py b/digihoxbackend/settings.py index ffaf0b1..4834f08 100644 --- a/digihoxbackend/settings.py +++ b/digihoxbackend/settings.py @@ -127,4 +127,38 @@ REST_FRAMEWORK = { ), } -CORS_ALLOW_ALL_ORIGINS = True # Admin WireGuard VPN only; safe for development +CORS_ALLOW_ALL_ORIGINS = True +CORS_ALLOW_CREDENTIALS = True + +CORS_ALLOWED_ORIGINS = [ + 'https://betacsa.tradhox.com', + 'https://csa.tradhox.com', + 'http://localhost:5173', + 'http://localhost:3000', +] + +CORS_ALLOWED_ORIGIN_REGEXES = [ + r"^https://.*\.tradhox\.com$", + r"^http://localhost:\d+$", +] + +CORS_ALLOW_HEADERS = [ + 'accept', + 'accept-encoding', + 'authorization', + 'content-type', + 'dnt', + 'origin', + 'user-agent', + 'x-csrftoken', + 'x-requested-with', +] + +CORS_ALLOW_METHODS = [ + 'DELETE', + 'GET', + 'OPTIONS', + 'PATCH', + 'POST', + 'PUT', +]