Skip to content

Commit 62a56f1

Browse files
authored
Merge pull request #211 from rragundez/cors-middleware
Add CORS middleware and update documentation
2 parents 6781103 + 74cbd5b commit 62a56f1

File tree

9 files changed

+298
-247
lines changed

9 files changed

+298
-247
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
* 🧑‍💼 **CRUDAdmin**: minimal admin panel (optional)
3939
* 🚦 ARQ background jobs (Redis)
4040
* 🧊 Redis caching (server + client-side headers)
41+
* 🌐 Configurable CORS middleware for frontend integration
4142
* 🐳 One-command Docker Compose
4243
* 🚀 NGINX & Gunicorn recipes for prod
4344

docs/getting-started/configuration.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,25 @@ DEFAULT_RATE_LIMIT_LIMIT=10 # Default: 10 requests
115115
DEFAULT_RATE_LIMIT_PERIOD=3600 # Default: 3600 seconds (1 hour)
116116
```
117117

118+
### CORS Configuration
119+
120+
Configure Cross-Origin Resource Sharing for your frontend:
121+
122+
```env
123+
# CORS Settings
124+
CORS_ORIGINS="*" # Comma-separated origins (use specific domains in production)
125+
CORS_METHODS="*" # Comma-separated HTTP methods or "*" for all
126+
CORS_HEADERS="*" # Comma-separated headers or "*" for all
127+
```
128+
129+
!!! warning "CORS in Production"
130+
Never use `"*"` for CORS_ORIGINS in production. Specify exact domains:
131+
```env
132+
CORS_ORIGINS="https://yourapp.com,https://www.yourapp.com"
133+
CORS_METHODS="GET,POST,PUT,DELETE,PATCH"
134+
CORS_HEADERS="Authorization,Content-Type"
135+
```
136+
118137
### First Tier
119138

120139
```env

0 commit comments

Comments
 (0)