allow controlling cors from config and add cors middleware to traefik

This commit is contained in:
Milo Schwartz 2025-01-13 23:59:10 -05:00
parent 7ff5376d13
commit ab18e15a71
No known key found for this signature in database
8 changed files with 98 additions and 43 deletions

View file

@ -4,6 +4,21 @@ http:
redirectScheme:
scheme: https
permanent: true
cors:
headers:
accessControlAllowMethods:
- GET
- PUT
- POST
- DELETE
- PATCH
accessControlAllowHeaders:
- Content-Type
- X-CSRF-Token
accessControlAllowOriginList:
- https://{{.DashboardDomain}}
accessControlAllowCredentials: false
routers:
# HTTP to HTTPS redirect router
@ -14,6 +29,7 @@ http:
- web
middlewares:
- redirect-to-https
- cors
# Next.js router (handles everything except API and WebSocket paths)
next-router:
@ -21,6 +37,8 @@ http:
service: next-service
entryPoints:
- websecure
middlewares:
- cors
tls:
certResolver: letsencrypt
@ -30,6 +48,8 @@ http:
service: api-service
entryPoints:
- websecure
middlewares:
- cors
tls:
certResolver: letsencrypt
@ -39,6 +59,8 @@ http:
service: api-service
entryPoints:
- websecure
middlewares:
- cors
tls:
certResolver: letsencrypt