首先,我生成了一个 pre-signed url,然后其它人,upload 了一个 text 文件到这个 pre-signed url 。设名字为 result.txt
接着,我的 web app,使用默认的 fetch method 直接去访问这个 pre-signed url,想下载这个 result.txt 。结果碰到了 CORS error 。我尝试着,直接用浏览器 chrome,打开这个 pre-signed url,能够正常下载这个 result.txt
然后,我又添加了 fetch 参数 no-cors,但是报错 403, forbidden
const res = fetch(pre-signed-url, { method: "GET", mode: "no-cors", headers: { Accept: "text/plain", "Content-Type": "text/plain" } }); 我又试了 axios, 但这个没有 mode 'no-cors'的设置,于是如下设置,得到的是 CORS error
const res: AxiosResponse<any> = await axios.get(url, { method: "GET", withCredentials: false, headers: { "Access-Control-Allow-Origin": "*", Accept: "text/plain", "Content-Type": "text/plain" } }); return res; 这个,接下来,除了去设置 xxx.s3.amazonaws.com 的 allow list 之外,还有什么方法么?
是不是我的 fetch 或者 axios.get 的参数设置不正确?为什么会被 forbidden?

