Browse Source

origin policy

pull/43/merge
Jae Kwon 10 years ago
parent
commit
17390b38ba
2 changed files with 4 additions and 17 deletions
  1. +0
    -4
      merkle/iavl_test.go
  2. +4
    -13
      rpc/http_server.go

+ 0
- 4
merkle/iavl_test.go View File

@ -12,10 +12,6 @@ import (
"testing"
)
func init() {
// TODO: seed rand?
}
func randstr(length int) string {
return RandStr(length)
}


+ 4
- 13
rpc/http_server.go View File

@ -48,19 +48,10 @@ func RecoverAndLogHandler(handler http.Handler) http.Handler {
begin := time.Now()
// Common headers
rww.Header().Set("Access-Control-Allow-Origin", "*")
/*
origin := r.Header.Get("Origin")
originUrl, err := url.Parse(origin)
if err == nil {
originHost := strings.Split(originUrl.Host, ":")[0]
if strings.HasSuffix(originHost, ".tendermint.com") {
rww.Header().Set("Access-Control-Allow-Origin", origin)
rww.Header().Set("Access-Control-Allow-Credentials", "true")
rww.Header().Set("Access-Control-Expose-Headers", "X-Server-Time")
}
}
*/
origin := r.Header.Get("Origin")
rww.Header().Set("Access-Control-Allow-Origin", origin)
rww.Header().Set("Access-Control-Allow-Credentials", "true")
rww.Header().Set("Access-Control-Expose-Headers", "X-Server-Time")
rww.Header().Set("X-Server-Time", fmt.Sprintf("%v", begin.Unix()))
defer func() {


Loading…
Cancel
Save