Answer the question
In order to leave comments, you need to log in
Why do browser get requests work in node.js but not?
I am trying to get a response from a request
axios.get('https://testnet.bitmex.com/api/v1/trade/bucketed?binSize=1d&partial=false&symbol=XBT&count=100&reverse=true')
.then(response => response.json())
.then(json => console.log('json',json))
GET https://testnet.bitmex.com/api/v1/trade/bucketed?binSize=1d&partial=false&symbol=XBT&count=100&reverse=true 403 ()
Failed to load https://testnet.bitmex.com/api/v1/trade/bucketed?binSize=1d&partial=false&symbol=XBT&count=100&reverse=true: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 403.
Answer the question
In order to leave comments, you need to log in
And you try to read the text of the error thoughtfully:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:3000' is therefore not allowed access.
The response had HTTP status code 403.
When a request is made from a browser, it is a request from a page (in the browser) that was given to it (the browser) by the same server.
When a request is made "from outside" - this is a request "unknown from whom". The server does not accept "unknown from" requests unless specifically allowed to accept "unknown from" requests.
In general, this is called CSRF (Cross Site Request Forgery - "cross-site request forgery")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question