Skip to content

jsonrpc: parsedURL parses the port and path incorrectly for path routed domains #6260

@fdymylja

Description

@fdymylja

Tendermint version: master

What happened: while using the jsonrpc client on load balancers which route to endpoints via path (ex: host.com:443/tmrpc) the address of the client is parsed in a not valid format.

How to reproduce it:

func TestEndpoint(t *testing.T) {
	x, err := rpchttp.New("https://example.com:443/rpc", "")
	if err != nil {
		t.Fatal(err)
	}
	_, err = x.Status(context.TODO())
	if err != nil {
		t.Fatal(err)
	}
}

This happens because the address is set here using the GetTrimmedHostWithPath function which ends up creating an URI with an invalid port (ex: :443.rpc).

I could provide a fast fix, but I'm not sure why the '/' to '.' replacement is done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions