good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit a6af56fa authored by Bas van Kervel's avatar Bas van Kervel
Browse files

rpc: disable CORS if user has not specified custom config

parent 5884606e
Branches
Tags
No related merge requests found
...@@ -162,6 +162,11 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { ...@@ -162,6 +162,11 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} }
func newCorsHandler(srv *Server, allowedOrigins []string) http.Handler { func newCorsHandler(srv *Server, allowedOrigins []string) http.Handler {
// disable CORS support if user has not specified a custom CORS configuration
if len(allowedOrigins) == 0 {
return srv
}
c := cors.New(cors.Options{ c := cors.New(cors.Options{
AllowedOrigins: allowedOrigins, AllowedOrigins: allowedOrigins,
AllowedMethods: []string{"POST", "GET"}, AllowedMethods: []string{"POST", "GET"},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment