Add CORS support and Docker configuration for web service
- Added CORS allowed origins in config.compose.yaml to enable cross-origin requests from the web service. - Updated docker-compose.yml to include a new web service with build context and port mapping for local development. - Enhanced gateway.go to support additional HTTP methods in CORS responses. - Updated README.md to document the new web service and its configuration requirements.
This commit is contained in:
@@ -98,7 +98,7 @@ func (g *Gateway) withCORS(next http.Handler) http.Handler {
|
||||
ok, allowOrigin := corsMatch(g.corsAllowed, origin)
|
||||
if ok {
|
||||
w.Header().Set("Access-Control-Allow-Origin", allowOrigin)
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Authorization, Content-Type, X-Request-Id")
|
||||
w.Header().Set("Access-Control-Max-Age", "86400")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user