Created
September 28, 2016 17:48
-
-
Save crobby/ea93df1129b4009a830834f2f1af590a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The middleware configuration is for the handler executors. These do not apply to the swagger.json document. | |
// The middleware executes after routing but before authentication, binding and validation | |
func setupMiddlewares(handler http.Handler) http.Handler { | |
corsHeaders := cors.New(cors.Options{ | |
AllowedOrigins: []string{"*"}, | |
AllowCredentials: true, | |
AllowedMethods: []string{"GET", "HEAD", "POST", "DELETE", "PUT"}, | |
OptionsPassthrough: false, // I have also tried true here | |
}) | |
handler = corsHeaders.Handler(handler) | |
return handler | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment