diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-05-02 20:53:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-02 20:53:47 +0800 |
commit | 5494e6e7ab384c7540147adb2a7206e57c99334b (patch) | |
tree | cf208b853f959796d6beecfdaa668521a1e90aca | |
parent | 5884606ec3c603c29337e527d348138fa2b9a27a (diff) | |
parent | a6af56fa4db64c29c05c08efdd8fec1f8d72ca30 (diff) | |
download | go-tangerine-5494e6e7ab384c7540147adb2a7206e57c99334b.tar.gz go-tangerine-5494e6e7ab384c7540147adb2a7206e57c99334b.tar.zst go-tangerine-5494e6e7ab384c7540147adb2a7206e57c99334b.zip |
Merge pull request #14399 from bas-vk/rpc-cors
rpc: disable CORS if user has not specified a custom config
-rw-r--r-- | rpc/http.go | 5 |
1 files changed, 5 insertions, 0 deletions
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"}, |