小编Nye*_*Kim的帖子

错误:对预检请求的响应未通过访问控制检查:请求的资源上没有"Access-Control-Allow-Origin"标头

我通过axios请求s3服务器,我也得到了Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.,在那之前,我得到了OPTIONS https://s3.ap-northeast-2.amazonaws.com/.../... 403 (Forbidden)

我应该在客户端解决这个问题.我在我的本地机器上托管我的文件.我的请求代码如下.

axios({
  url: 'https://s3.ap-northeast-2.amazonaws.com/.../...',
  method: 'get',
  withCredentials: true,
  headers: {
    'Content-Type': 'image/jpeg',
    'Access-Control-Allow-Origin': 'http://*, https://*',
  }
Run Code Online (Sandbox Code Playgroud)

})

我试过了

  1. start chrome --disable-web-security 用git
  2. 安装的chrome插件 - Allow-Control-Allow-Origin:*

没有用......我怎么解决这个问题?

get xmlhttprequest amazon-s3 axios

5
推荐指数
1
解决办法
5169
查看次数

创建 aws ec2 实例后 Nginx 不工作

创建运行 Ubuntu 的 AWS EC2 实例后,我使用 Putty 启动了 ubuntu。然后我使用以下命令安装了 Nginx: sudo apt-get udpate之后 sudo apt-get install nginx ,为了检查 Nginx 是否正常工作,我在浏览器中输入了 IP 地址,但出现ERR_CONNECTION_TIMED_OUT错误。为什么 Nginx 不工作?我只关注了https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04。我不知道为什么它不起作用。

ubuntu nginx amazon-ec2 amazon-web-services

2
推荐指数
2
解决办法
7190
查看次数