aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorBas van Kervel <basvankervel@gmail.com>2017-05-02 17:14:40 +0800
committerBas van Kervel <basvankervel@gmail.com>2017-05-02 17:14:40 +0800
commita6af56fa4db64c29c05c08efdd8fec1f8d72ca30 (patch)
treecf208b853f959796d6beecfdaa668521a1e90aca /rpc
parent5884606ec3c603c29337e527d348138fa2b9a27a (diff)
downloadgo-tangerine-a6af56fa4db64c29c05c08efdd8fec1f8d72ca30.tar
go-tangerine-a6af56fa4db64c29c05c08efdd8fec1f8d72ca30.tar.gz
go-tangerine-a6af56fa4db64c29c05c08efdd8fec1f8d72ca30.tar.bz2
go-tangerine-a6af56fa4db64c29c05c08efdd8fec1f8d72ca30.tar.lz
go-tangerine-a6af56fa4db64c29c05c08efdd8fec1f8d72ca30.tar.xz
go-tangerine-a6af56fa4db64c29c05c08efdd8fec1f8d72ca30.tar.zst
go-tangerine-a6af56fa4db64c29c05c08efdd8fec1f8d72ca30.zip
rpc: disable CORS if user has not specified custom config
Diffstat (limited to 'rpc')
-rw-r--r--rpc/http.go5
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"},