feat(api): configure CORS origins from environment variable (FRO-61)#34
Merged
pierrick-fonquerne merged 3 commits intodevelopfrom Jan 19, 2026
Merged
feat(api): configure CORS origins from environment variable (FRO-61)#34pierrick-fonquerne merged 3 commits intodevelopfrom
pierrick-fonquerne merged 3 commits intodevelopfrom
Conversation
- Read CorsOrigins from configuration/environment variable - Support multiple origins separated by comma - Fallback to localhost:5173 for local development - Allows Vercel frontend to connect to Railway backend Build: ✓ (0 warnings, 0 errors) Tests: ✓ (157 passed - 113 unit + 44 integration)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add .env.staging with Railway staging API URL - Add .env.production placeholder for future production environment - Add build:staging script to use staging configuration - Allow .env.staging and .env.production in git (no secrets, only public URLs) - Simplify api.ts to rely on environment files Environment configuration: - Development: localhost:5000/api (fallback) - Staging: https://fantasyrealm-api-staging.up.railway.app/api - Production: To be configured with Railway production URL Build: ✓ (staging mode verified)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🎯 Objectif
Permettre au frontend Vercel de communiquer avec le backend Railway en configurant CORS via variable d'environnement.
📋 Changements
Program.cs (lignes 23-36)
✅ Avantages
http://localhost:5173par défaut (pas de config nécessaire)CorsOriginsdéjà configurée sur Railwayhttps://staging.fantasy-realm.com,https://*.vercel.app🧪 Tests
🚀 Impact
Une fois mergé, Railway redéploiera automatiquement avec la nouvelle configuration CORS. Le frontend Vercel pourra alors appeler l'API Railway sans erreur "Impossible de contacter le serveur".
📝 Ticket Jira
FRO-61: Déploiement infrastructure recette (Railway + MongoDB Atlas)