Commit a3a5f8b5 authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

Merge pull request #1032 from tgerring/issue1025

Multiple CORS domains support
parents 677796b3 a2598e64
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strings"
"github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger/glog" "github.com/ethereum/go-ethereum/logger/glog"
...@@ -39,7 +40,7 @@ func Start(pipe *xeth.XEth, config RpcConfig) error { ...@@ -39,7 +40,7 @@ func Start(pipe *xeth.XEth, config RpcConfig) error {
if len(config.CorsDomain) > 0 { if len(config.CorsDomain) > 0 {
var opts cors.Options var opts cors.Options
opts.AllowedMethods = []string{"POST"} opts.AllowedMethods = []string{"POST"}
opts.AllowedOrigins = []string{config.CorsDomain} opts.AllowedOrigins = strings.Split(config.CorsDomain, " ")
c := cors.New(opts) c := cors.New(opts)
handler = newStoppableHandler(c.Handler(JSONRPC(pipe)), l.stop) handler = newStoppableHandler(c.Handler(JSONRPC(pipe)), l.stop)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment