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.

Fetch blocked by CORS policy.

See original GitHub issue

Hello, I’m a Mobile Apps Developer and i’m using Ionic Framework to create one.

I’ve been using Wttr.in for the past 2 months without fails but, yesterday, I came across this error: Image Pasted at 2020-6-1 22-31

Before, everything worked perfectly, and I wasn’t expecting to have this error. After searching the Internet, I got the feeling that your server is not accepting external requests.

Interestingly, the request works in python, doing something like that:

import requests
r = requests.get("http://wttr.in?format=j1")
print(r.json())

But when I make an asynchronous request using Javascript or Typescript I get a CORS error - on browser and Android.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
chubincommented, Jun 2, 2020

Sorry, it was my fault. Please test it now

$ curl -I wttr.in
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Tue, 02 Jun 2020 11:17:13 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 8781
Connection: keep-alive
Access-Control-Allow-Origin: *
1reaction
chubincommented, Jun 11, 2020

Wow! It looks very cool, and maybe #453 would be interesting to you. @mcantsin has disappeared, but the issue is still relevant, and the features should be implemented, so maybe you have some improvement ideas

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Access to fetch `url` been blocked by CORS policy ...
Access to fetch at 'url' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present ...
Read more >
Fetch has been blocked by CORS policy | Jeremy Liberman
No. CORS restricts access to the request's response via client-side JavaScript, but it doesn't prevent the request from reaching the server. If ...
Read more >
Access to fetch been blocked by CORS policy - React Native + ...
This issue relate the 'no-cors' mode. Try to remove it. Access to fetch at 'https://localhost:40011/api/Games/GamesList' from origin 'http:// ...
Read more >
Fixing Common Problems with CORS and JavaScript
The message says that the browser has blocked the request because of a CORS policy. It suggests two solutions. The second suggestion is...
Read more >
Fetch: Cross-Origin Requests - The Modern JavaScript Tutorial
That policy is called “CORS”: Cross-Origin Resource Sharing. Why is CORS needed? A brief history. CORS exists to protect the internet from evil ......
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