用 ajax 上传文件,返回 400 错误,提示:
Access to XMLHttpRequest at 'https://v0.api.upyun.com/xxx' from origin 'https://xxxxx' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
难道这个接口只能用 HTML 的 form
提交?不能 ajax 调用?
2
phy25 2019-05-30 02:24:02 +08:00
应该是支持的哦。需要检查一下你的代码和浏览器环境呢。
Request URL: https://v0.api.upyun.com/repo Request Method: OPTIONS Status Code: 200 Remote Address: 204.237.243.107:443 Referrer Policy: no-referrer-when-downgrade access-control-allow-headers: Authorization, Content-Type, X-Date, Folder access-control-allow-methods: PUT, GET, POST, HEAD, OPTIONS, DELETE access-control-allow-origin: * content-type: application/octet-stream date: Wed, 29 May 2019 18:20:24 GMT server: marco/2.10 status: 200 |