From a6af56fa4db64c29c05c08efdd8fec1f8d72ca30 Mon Sep 17 00:00:00 2001 From: Bas van Kervel Date: Tue, 2 May 2017 11:14:40 +0200 Subject: rpc: disable CORS if user has not specified custom config --- rpc/http.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'rpc') diff --git a/rpc/http.go b/rpc/http.go index 022f9ce8f..6bab02ab6 100644 --- a/rpc/http.go +++ b/rpc/http.go @@ -162,6 +162,11 @@ func (srv *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } 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{ AllowedOrigins: allowedOrigins, AllowedMethods: []string{"POST", "GET"}, -- cgit