Skip to content

fix(cors): update production origins and fix .env loading (B-1) - #45

Open
Hamza-Ali0719 wants to merge 7 commits into
QuantumLogicsLabs:mainfrom
Hamza-Ali0719:fix/b1-cors-env-fix
Open

fix(cors): update production origins and fix .env loading (B-1)#45
Hamza-Ali0719 wants to merge 7 commits into
QuantumLogicsLabs:mainfrom
Hamza-Ali0719:fix/b1-cors-env-fix

Conversation

@Hamza-Ali0719

Copy link
Copy Markdown
Contributor

Objective: B-1 - Backend CORS Misconfiguration (Root Cause)

Problem:

The production frontend lives at https://calculus.quantumlogicslimited.com

The ALLOWED_ORIGINS list still contained the placeholder https://your-calculus-website.com

This blocked all API requests from production due to CORS policy

.env loading was relative to the working directory, breaking inside Docker/CI

Fix Applied:

✅ Added production domain to ALLOWED_ORIGINS in backend/app/main.py

✅ Added production domain to ALLOWED_AI_ORIGINS in aiService/chatbot.py

✅ Added support for ALLOWED_ORIGINS_EXTRA env var (comma-separated) for future domains

✅ Fixed .env loading in aiService/services/llm_client.py to use Path(file).parent / ".env"

Testing Performed:

✅ Backend starts without errors

✅ CORS preflight passes for production domain

✅ API keys load correctly in Docker/CI

Closes: B-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant