CORS Setup
Basic CORS Setup
1. Enable CORS in Environment
# Enable CORS
CORS_ENABLED=true
# Allow specific origins
CORS_ALLOWED_ORIGINS=https://baseapp.com,https://baseapp.dev
# Configure allowed methods and headers
CORS_ALLOWED_METHODS=GET, POST, PUT, DELETE, OPTIONS
CORS_ALLOWED_HEADERS=Content-Type, Authorization, X-Requested-With
# Enable credentials if needed
CORS_ALLOW_CREDENTIALS=true
# Cache preflight for 24 hours
CORS_MAX_AGE=864002. Router Handles CORS Automatically
CORS Configuration Examples
Development Setup
Production Setup
Wildcard Subdomain Setup
Frontend Integration
JavaScript Fetch API
Axios Configuration
CORS Headers Explained
Response Headers Set by Base
Preflight Request Flow
Security Considerations
Origin Validation
Credentials Handling
Header Restrictions
Troubleshooting CORS
Common Issues
Debug CORS Issues
Browser Developer Tools
Testing CORS
Manual Testing with cURL
Automated Testing
Last updated