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.

Origin is not allowed by Access-Control-Allow-Origin

See original GitHub issue

Hi, I’m using public API method in JavaScript on my local PC. But request failed because of Single-Origin-Policy.

The code is something like this.

<html>
<head>
  <meta chartset="utf-8">
  <script type="text/javascript" src="https://unpkg.com/ccxt"></script>
</head>
<body>
  <h1>jQuery Request</h1>
  <script>
    var bitflyer = new ccxt.bitflyer();
    bitflyer.fetchTicker('BTC/JPY').then(function(data) {console.log(data);});
  </script>
</body>
</html>

I received following error.

Origin null is not allowed by Access-Control-Allow-Origin.

How can I fix this?

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kroitorcommented, Nov 7, 2017

@aiueogawa I can also suggest trying a public proxy:

bitflyer.proxy = 'https://cors-anywhere.herokuapp.com/'
# or
bitflyer.proxy = 'https://crossorigin.me/'

bitflyer.fetch_ticker('BTC/JPY')

If it works for you with any of these two proxies, then you still can set up a proper local proxy, just need to read more about their setup (depending on which one you choose).

1reaction
aiueogawacommented, Nov 7, 2017

@kroitor I have no more questions. Thank you for all!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Origin is not allowed by Access-Control-Allow-Origin
I wrote an article on this issue a while back, Cross Domain AJAX. The easiest way to handle this if you have control...
Read more >
Reason: CORS header 'Access-Control-Allow-Origin' missing
The response to the CORS request is missing the required Access-Control-Allow-Origin header, which is used to determine whether or not the ...
Read more >
Fixing "No 'Access-Control-Allow-Origin' Header Present"
This error occurs when a script on your website/web app attempts to make a request to a resource that isn't configured to accept...
Read more >
3 Ways to Fix the CORS Error — and How the Access- ...
Fix one: install the Allow-Control-Allow-Origin plugin. The quickest fix you can make is to install the moesif CORS extension .
Read more >
Error Origin is not allowed by Access-Control-Allow-Origin
This will allow cross-domain Ajax. In PHP, you'll want to modify the response like so: <?php header('Access-Control-Allow-Origin: *') ...
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