Error 426 from newsapi.org once I deployed my site on Netlify

 ̄綄美尐妖づ 提交于 2021-01-24 07:38:06

问题


While I was trying my project on localhost it was working fine, using https://cors-anywhere.herokuapp.com/ since I got the CORS problem. But once I deployed the site on Netlify, it gave me the error 426 (Upgrade Required), with or without using https://cors-anywhere.herokuapp.com/. These are the messages that appear on my console:

>Failed to load resource: the server responded with a status of 426 (Upgrade Required)

>Error: Request failed with status code 426
    at createError.js:16
    at settle.js:17
    at XMLHttpRequest.<anonymous> (xhr.js:61)

I have been searching and some people seem to have similar problem to this. I have seen solutions like having my own server to pass the requests, but I don't know how to do it and, correct me if I am wrong, wouldn't that be the same as using https://cors-anywhere.herokuapp.com/?


回答1:


Newsapi changed their pricing model.

You can't make requests from the browser anymore, you'll have to use a backend. I had the same problem and the easiest way around it was implementing a Node (Express) server.




回答2:


I guess the free plan simply is not longer available in production.

"Requests from the browser are not allowed on the Developer plan, except from localhost."

Here's the updated plan page.. https://newsapi.org/pricing



来源:https://stackoverflow.com/questions/62157026/error-426-from-newsapi-org-once-i-deployed-my-site-on-netlify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!