diff --git a/node/rpcstack.go b/node/rpcstack.go index 20d488b734..1db2ed3f44 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -463,6 +463,7 @@ func (h *virtualHostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { // Either invalid (too many colons) or no port specified host = r.Host } + host = strings.ToLower(host) if ipAddr := net.ParseIP(host); ipAddr != nil { // It's an IP address, we can serve that h.next.ServeHTTP(w, r) diff --git a/node/rpcstack_test.go b/node/rpcstack_test.go index bd75dac4eb..f5668abb08 100644 --- a/node/rpcstack_test.go +++ b/node/rpcstack_test.go @@ -60,6 +60,9 @@ func TestVhosts(t *testing.T) { resp := rpcRequest(t, url, testMethod, "host", "test") assert.Equal(t, resp.StatusCode, http.StatusOK) + respUpper := rpcRequest(t, url, testMethod, "host", "TeSt:1234") + assert.Equal(t, respUpper.StatusCode, http.StatusOK) + resp2 := rpcRequest(t, url, testMethod, "host", "bad") assert.Equal(t, resp2.StatusCode, http.StatusForbidden) } diff --git a/signer/core/api.go b/signer/core/api.go index 12acf925f0..3b7b53a312 100644 --- a/signer/core/api.go +++ b/signer/core/api.go @@ -196,8 +196,9 @@ func MetadataFromContext(ctx context.Context) Metadata { if info.Transport != "" { if info.Transport == "http" { m.Scheme = info.HTTP.Version + } else { + m.Scheme = info.Transport } - m.Scheme = info.Transport } if info.RemoteAddr != "" { m.Remote = info.RemoteAddr