question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refused to set unsafe header "origin"

See original GitHub issue

I’m trying to use a CORS proxy to access BitMEX. https://crossorigin.me is down (I see the Cloudflare page), so I tried the Node proxy. I’ve verified that http://localhost:4080/https://www.bitmex.com/api/v1/instrument/activeAndIndices returns correct data in the browser.

The problems is that when I try const markets = await bitmex.load_markets(); in the browser, I get this error:

Refused to set unsafe header “origin” (anonymous) @ fetch-browser.js:470 fetch-browser.js:473 GET http://localhost:4080/https://www.bitmex.com/api/v1/instrument/activeAndIndices 403 (Forbidden)

I get the same error with another proxy, https://cors-anywhere.herokuapp.com/:

image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
imhazigecommented, Jun 18, 2018

@kroitor This problem appear again. version v1.14.209. I am sure when using v1.14.180, it have not such a problem. I am always using a proxy. refer to issue #3171

1reaction
kroitorcommented, Dec 25, 2017

However, isn’t the job of the bitmex CCXT library to put those headers in the request ?

Not really, the point is that in the browser you can’t set the Origin header at all. Bitmex does not support CORS at all. This is the reason for using the CORS proxy in the first place – we need to set some headers, but we can’t do it in the browser (forbidden by the browser security settings), therefore we have to set those headers on the proxy.

How did this work before?

With proper HTTPS tunneling via a CORS-proxy, it should work, like it does for most exchanges, however, it doesn’t work for BitMEX for some reason. I will investigate further and will get back to you on this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refused to set unsafe header "Origin" when using ...
I tried removing the receiveReq.setRequestHeader("Origin", ...) call but then Google Chrome throws an access error on my receiveReq.open() call.
Read more >
How to fix Refused to set unsafe header Origin while making ...
Refused to set unsafe header Origin error message​​ when you send requests across domains. For this, we need to set up the Access-Control-Allow- ......
Read more >
Refused to set unsafe header "Origin" · Issue #257 - GitHub
I solved it by setting the right header on the source. I.E your api server. ChacesY notifications@github.com schrieb am So., 10. Apr. 2016...
Read more >
Refused to get unsafe header - TrackJS
The message describes a failed attempt to access header data from a network request. We discovered this error while working on a prototype...
Read more >
set-dangerous-headers-local-expected.txt - Google Git
Test that setRequestHeader cannot be used to alter security-sensitive headers for file:// urls. SUCCESS. Powered by Gitiles| Privacy ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found