从CloudFront获取图片由于CORS而被阻止。

0

【以下的问题经过翻译处理】 我正在使用NextJs和@react-three/fiber实现非常基本的功能。我必须使用一些“底层”函数来加载纹理,但我一直遇到CORS错误。我的图片在Cloud Front和S3中是公开可访问的,在“img”标签内从浏览器中加载正常,但是获取资源就无法正常工作...我尝试遵循各种随机教程(很多),但是没有任何“设置头”或“向Cloud Front添加策略”对我有用...我可以使用像https://api.allorigins.win/raw?url=${url}这样的服务来获取这个图像,但对我来说这是不必要的,因为我是所有必要技术账户/代码库等的所有者-肯定有一种避免第三方服务的方法...非常感谢您的帮助。

profile picture
EXPERT
asked 6 months ago18 views
1 Answer
0

【以下的回答经过翻译处理】 一种方法是通过查找CloudFront签名url或cookie获取图像:https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-signed-urls.html

profile picture
EXPERT
answered 6 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions