Skip to content

Commit e543877

Browse files
feat: Add Railway service reference support for dynamic CORS configuration
Enable CORS configuration via Railway's dynamic service references to eliminate hardcoded URLs and support automatic URL updates on redeployment. Key Changes: - Added admin_panel_url and additional_cors_origins to settings - Implemented dynamic CORS origin building from environment variables - Created comprehensive CORS vs Authentication documentation - Added Railway-specific CORS setup guide with service references Benefits: - No hardcoded URLs needed in code - Lower latency with Railway internal routing - Automatic updates when services are redeployed - Clear distinction between browser-only CORS and server-side auth Server-side team clients (Python, Node.js, curl) are unaffected by CORS restrictions - they work from anywhere with Bearer tokens. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 75d741c commit e543877

9 files changed

Lines changed: 967 additions & 14 deletions

File tree

.env.example

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ LITELLM_MASTER_KEY=sk-litellm-your-super-secure-litellm-key-here
1515
# Railway: http://litellm-proxy.railway.internal:4000
1616
LITELLM_PROXY_URL=http://localhost:8002
1717

18+
# LiteLLM Database Storage (persist models/teams/keys in database)
19+
STORE_MODEL_IN_DB=True
20+
1821
# API Keys for LLM Providers
1922
OPENAI_API_KEY=your-openai-api-key
2023
ANTHROPIC_API_KEY=your-anthropic-api-key
2124

22-
# Redis Configuration (optional, for caching)
23-
REDIS_HOST=
25+
# Redis Configuration (required for LiteLLM caching and rate limiting)
26+
REDIS_HOST=localhost
2427
REDIS_PORT=6379
2528
REDIS_PASSWORD=
29+
REDIS_URL=redis://localhost:6379
2630

2731
# Server Settings
2832
HOST=0.0.0.0

docs/admin-dashboard/overview.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,14 @@ openssl rand -hex 32
309309
3. **IP Whitelist** - Limit access to specific IPs
310310
4. **Rate Limiting** - Prevent brute force attacks
311311
5. **Audit Logging** - Log all admin actions
312+
6. **CORS Configuration** - Add production admin panel URL to CORS
313+
314+
!!! tip "CORS Configuration Required"
315+
The admin panel is browser-based, so it requires CORS configuration in the SaaS API.
316+
317+
You must add your production admin panel URL to the `allow_origins` list in `src/saas_api.py`.
318+
319+
[:octicons-arrow-right-24: Learn how to configure CORS](../deployment/cors-and-authentication.md)
312320

313321
### Data Protection
314322

0 commit comments

Comments
 (0)