Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upload组件OSS跨域问题 #3594

Closed
cn-sanxs opened this issue Jun 17, 2019 · 6 comments
Closed

upload组件OSS跨域问题 #3594

cn-sanxs opened this issue Jun 17, 2019 · 6 comments

Comments

@cn-sanxs
Copy link

Reproduction link

https://p7pywo.run.stackblitz.io/

Steps to reproduce

官方例子中的上上传步骤

  1. 将官方上传中的nzCustomRequest路径改成阿里云oss地址
    2.点击上传,出现跨域报错,但是查看请求是返回200
    3.已经确定在oss上设置过跨域配置,并且在同一个页面上使用富文本上传图片到同一个oss的同一个bucket下成功,并没有出现跨域。

What is expected?

上传成功

What is actually happening?

跨域

Environment Info
ng-zorro-antd 7.5.1
Browser 谷歌
@ng-zorro-bot
Copy link
Collaborator

Translation of this issue:


upload component OSS cross-domain problem

Reproduction link

https://p7pywo.run.stackblitz.io/

Steps to reproduce

Upload step in the official example

  1. Change the nzCustomRequest path in the official upload to Alibaba Cloud oss ​​address
  2. Click Upload, there is a cross-domain error, but the request is returned 200
  3. It has been determined that the cross-domain configuration is set on oss, and the rich text is uploaded on the same page to the same bucket of the same oss, and there is no cross-domain.

What is expected?

Upload success

What is actually happening?

Cross-domain

Environment Info
ng-zorro-antd 7.5.1
Browser Google

@cn-sanxs
Copy link
Author

@cipchk
Copy link
Member

cipchk commented Jun 17, 2019

@VolcanoOves 建议同富文本框的请求参数(包括:headerbody 等)做比较;另外 withCredentials 不一定所有服务端多支持,我对阿里OSS并不了解,无法提供更有效的信息。

@cn-sanxs
Copy link
Author

@cipchk 富文本发起的是post请求,上传组件发起的是一个options请求返回200,但是控制台输出了跨域错误,options请求成功之后也没有发起post请求

@cn-sanxs
Copy link
Author

Access to XMLHttpRequest at 'https://xden.oss-cn-beijing.aliyuncs.com/' from origin 'https://angular-bvcvps.stackblitz.io' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

@cn-sanxs
Copy link
Author

@cipchk 就是这个withCredentials的参数问题,我删除该项之后就成功上传。谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants