Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WS to HTTP redirection doesn't seem to be handle correctly #638

Closed
paulormart opened this issue Jan 5, 2022 · 3 comments
Closed

WS to HTTP redirection doesn't seem to be handle correctly #638

paulormart opened this issue Jan 5, 2022 · 3 comments

Comments

@paulormart
Copy link

@paulormart

please open an issue in jsonrpsee but the issue is that you got a HTTP redirection there... to a HTTP endpoint

target: Target { sockaddrs: [104.26.8.125:80, 104.26.9.125:80, 172.67.71.26:80, [2606:4700:20::681a:97d]:80, [2606:4700:20::ac43:471a]:80, [2606:4700:20::681a:87d]:80], host: "rpc.polkadot.io", host_header: "rpc.polkadot.io:80", _mode: Plain, path_and_query: "/" }
2022-01-05T15:32:34.132404Z DEBUG jsonrpsee_client_transport::ws: Connecting to target: Target { sockaddrs: [104.26.8.125:80, 104.26.9.125:80, 172.67.71.26:80, [2606:4700:20::681a:97d]:80, [2606:4700:20::ac43:471a]:80, [2606:4700:20::681a:87d]:80], host: "rpc.polkadot.io", host_header: "rpc.polkadot.io:80", _mode: Plain, path_and_query: "/" }
2022-01-05T15:32:34.266608Z DEBUG jsonrpsee_client_transport::ws: Redirection: status_code: 301, location: https://rpc.polkadot.io/
thread 'main' panicked at 'Some("https")', client/transport/src/ws/mod.rs:440:17

Thus, meanwhile use wss://rpc.polkadot.io:443 if that's alright for you.

Originally posted by @niklasad1 in paritytech/subxt#384 (comment)

@paulormart paulormart changed the title WS to HTTP redirection doesn't to be handle correctly WS to HTTP redirection doesn't seem to be handle correctly Jan 5, 2022
@paulormart
Copy link
Author

paulormart commented Jan 5, 2022

Thanks for reviewing this @niklasad1

If wss://rpc.polkadot.io:443 is used from the subxt side we get this error Error: Rpc(Transport(Invalid URL: URL scheme not supported, expects 'ws'))

@paulormart
Copy link
Author

Ok got it. client-ws-transport feature was missing from the client library.

Cargo file should specify it like jsonrpsee = { version = "0.7.0", features = ["macros", "ws-client", "http-client", "client-ws-transport"] }

@niklasad1
Copy link
Member

niklasad1 commented Jan 5, 2022

The redirection is still an issue but I don't think there is anything we can do besides print a better error message in the ws client.

Ok got it. client-ws-transport feature was missing from the client library.

good catch, it's a bug the ws-client crate should expose that feature but you can solve it like that too :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants