Actual
I setup a Parity node and tried to connect with a local copy of MyEtherWallet. The request to JSONRPC endpoint always fails with HTTP error 415 (Unsupported Media Type). Response body says Supplied content type is not allowed. Content-Type: application/json is required
This is the request exported from chrome dev tools in curl format, note the uppercase charset attribute:
curl 'http://192.168.0.93:8545/' -H 'Accept: application/json, text/plain, /' -H 'Origin: null' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36' -H 'Content-Type: application/json; charset=UTF-8' --data-binary '{"method":"eth_blockNumber","id":"1577adb21150879672050dc036f81551","jsonrpc":"2.0"}' --compressed
Expected
The same request with the charset attribute in lowercase works fine. I believe the expected behaviour is that the request should work even with uppercase charset attribute.
Work around
I had to setup an nginx proxy to rewrite the _Content-Type_ header to make MyEtherWallet work.
upstream jsonrpc {
server 127.0.0.1:8545;
}
server {
...
location / {
proxy_pass http://jsonrpc;
proxy_http_version 1.1;
proxy_set_header content-type "application/json";
}
}
This works, without nginx rewrite it gives me an error, HTTP error 415 (Unsupported Media Type).
Most likely an issue with jsonrpc-http-server after recent migration to newest hyper: https://github.com/paritytech/jsonrpc/blob/0d78b8f145c18f08c1103f6b0b51991a89fb0a6f/http/src/handler.rs#L567
I just tested this with 2.2.9 and it seems to happening there, but I guess the fix was for 2.3+
Fix is in 2.4+
Most helpful comment
Fix is in 2.4+