I started geth
on a remote server running on rinkeby with the parameters --rinkeby --fast --cache=128 --rpc --rpcaddr 0.0.0.0
When I try to test my access to geth
using
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://my-geth-remote-server:8545
I received the response
invalid content type, only application/json is supported
Pretty confused about the error, isnt the RPC payload given in JSON already?
Geth used is Geth/v1.7.3-unstable-9b97f983/linux-amd64/go1.9.2
Response of curl after adding -v
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":42}' http://8.8.8.8:8545 -v
* Rebuilt URL to: http://8.8.8.8:8545/
* timeout on name lookup is not supported
* Trying 8.8.8.8...
* TCP_NODELAY set
* Connected to 8.8.8.8 (8.8.8.8) port 8545 (#0)
> POST / HTTP/1.1
> Host: 8.8.8.8:8545
> User-Agent: curl/7.55.0
> Accept: */*
> Content-Type: application/json
> Content-Length: 57
>
* upload completely sent off: 57 out of 57 bytes
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Mon, 13 Nov 2017 21:39:48 GMT
< Content-Length: 109
<
{"jsonrpc":"2.0","error":{"code":-32600,"message":"invalid character '\\'' looking for beginning of value"}}
* Connection #0 to host 8.8.8.8 left intact
curl --version
curl 7.55.0 (x86_64-w64-mingw32) libcurl/7.55.0 OpenSSL/1.0.2l zlib/1.2.11 libssh2/1.8.0 nghttp2/1.23.1
Release-Date: 2017-08-09
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL libz TLS-SRP HTTP2 HTTPS-proxy Metalink
This is the windows versions of curl
.
-H "Content-Type: application/json"
curl --version
curl
, my macbook is currently downcurl.exe
on Windows and is having issues with quotes. See this related SO questioncurl -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":42}" http://8.8.8.8:8545