File tree 1 file changed +14
-1
lines changed
1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -367,7 +367,20 @@ func setupMiddlewares(handler http.Handler) http.Handler {
367
367
// The middleware configuration happens before anything, this middleware also applies to serving the swagger.json document.
368
368
// So this is a good place to plug in a panic handling middleware, logging and metrics
369
369
func setupGlobalMiddleware (handler http.Handler ) http.Handler {
370
- handleCORS := cors .AllowAll ().Handler
370
+ handleCORS := cors .New (cors.Options {
371
+ AllowedOrigins : []string {"*" },
372
+ AllowedMethods : []string {
373
+ http .MethodHead ,
374
+ http .MethodGet ,
375
+ http .MethodPost ,
376
+ http .MethodPut ,
377
+ http .MethodPatch ,
378
+ http .MethodDelete ,
379
+ },
380
+ AllowedHeaders : []string {"*" },
381
+ AllowCredentials : true ,
382
+ MaxAge : 86400 ,
383
+ }).Handler
371
384
recovery := adapters .RecoverMiddleware (log .StandardLogger ())
372
385
logViaLogrus := adapters .LoggingMiddleware (log .StandardLogger ())
373
386
return (logViaLogrus (handleCORS (recovery (handler ))))
You can’t perform that action at this time.
0 commit comments