1

我正在使用cloudinary服务在我的反应应用程序中显示图像,方法是使用与TS一起使用的React SDK v2的新测试版。我正在使用文档中描述的功能,但作为回报我有

ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep 200

这是我的代码:

const cld = new Cloudinary({
    cloud: {
        cloudName: "mycloudname",
    }
});
const myImage = cld.image("sample");

我是 CORS 使用的新手,所以我可能遗漏了一些东西,但在新的 SDK 中,我找不到应该添加标题以允许 CORS 的任何地方。

有人能帮我吗?

4

1 回答 1

0

The header must be set on the server side and not on the client-side. My assumption is that you're using nodejs environment, below might be useful to you when setting the response header: https://nodejs.org/api/http.html#responsesetheadername-value

The specific header you're looking to set is: Access-Control-Allow-Origin

于 2021-10-27T22:15:22.380 回答