When trying to use the API in browser via web3.js, no call is being processed by myetherwallet.
After investigation, it turn out that the OPTIONS request made by the browser to check CORS support is not getting passed to the MyEtherWallet API endpoint, and is instead blocked by the Cloudflare server. Following is the OPTIONS request and the corresponding CloudFlare response:
Request:
OPTIONS /eth HTTP/1.1
Host: api.myetherapi.com
Connection: close
Access-Control-Request-Method: POST
Origin: null
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2837.0 Safari/537.36
Access-Control-Request-Headers: content-type
Accept: /
Accept-Encoding: gzip, deflate
Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Response:
HTTP/1.1 403 Forbidden
Server: CloudFront
Date: Tue, 05 Dec 2017 10:03:40 GMT
Content-Type: text/html
Content-Length: 555
Connection: close
X-Cache: Error from cloudfront
Via: 1.1 d7d3ef7b74c87e295676d270227068b9.cloudfront.net (CloudFront)
X-Amz-Cf-Id: DDvrcDeSkZnlXMvMnrbqXQmdh51Z5oKIsTFm0sWR9Ri8DlZ1YoeG3g==
<TITLE>ERROR: The request could not be satisfied</TITLE>
<\h1>ERROR<\/h1>
<\h2>The request could not be satisfied.<\/h2>
Request blocked.
Generated by cloudfront (CloudFront)
Request ID: DDvrcDeSkZnlXMvMnrbqXQmdh51Z5oKIsTFm0sWR9Ri8DlZ1YoeG3g==
When trying to use the API in browser via web3.js, no call is being processed by myetherwallet.
After investigation, it turn out that the OPTIONS request made by the browser to check CORS support is not getting passed to the MyEtherWallet API endpoint, and is instead blocked by the Cloudflare server. Following is the OPTIONS request and the corresponding CloudFlare response:
Request:
OPTIONS /eth HTTP/1.1
Host: api.myetherapi.com
Connection: close
Access-Control-Request-Method: POST
Origin: null
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2837.0 Safari/537.36
Access-Control-Request-Headers: content-type
Accept: /
Accept-Encoding: gzip, deflate
Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4
Response:
HTTP/1.1 403 Forbidden
<TITLE>ERROR: The request could not be satisfied</TITLE> <\h1>ERROR<\/h1> <\h2>The request could not be satisfied.<\/h2>Server: CloudFront
Date: Tue, 05 Dec 2017 10:03:40 GMT
Content-Type: text/html
Content-Length: 555
Connection: close
X-Cache: Error from cloudfront
Via: 1.1 d7d3ef7b74c87e295676d270227068b9.cloudfront.net (CloudFront)
X-Amz-Cf-Id: DDvrcDeSkZnlXMvMnrbqXQmdh51Z5oKIsTFm0sWR9Ri8DlZ1YoeG3g==
Request blocked.