在 Netlify 上部署我的网站后,来自 newsapi.org 的错误 426

Pab*_*res 3 https http netlify cors-anywhere

当我在本地主机上尝试我的项目时,它运行良好,因为我遇到了 CORS 问题,所以使用https://cors-anywhere.herokuapp.com/。但是一旦我在 Netlify 上部署了该站点,无论是否使用https://cors-anywhere.herokuapp.com/,它都会给我错误 426(需要升级)。这些是出现在我的控制台上的消息:

>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)
Run Code Online (Sandbox Code Playgroud)

我一直在寻找,有些人似乎有类似的问题。我见过像拥有自己的服务器来传递请求这样的解决方案,但我不知道该怎么做,如果我错了,请纠正我,这与使用https://cors-anywhere 不一样。 herokuapp.com/ ?

Oza*_*k19 5

Newsapi 改变了他们的定价模式。

您不能再从浏览器发出请求,您必须使用后端。我遇到了同样的问题,最简单的解决方法是实现 Node (Express) 服务器。