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

上传文件报错cors #3

Closed
spencer17x opened this issue Sep 6, 2021 · 10 comments
Closed

上传文件报错cors #3

spencer17x opened this issue Sep 6, 2021 · 10 comments
Assignees

Comments

@spencer17x
Copy link

image
如图,按照文档运行项目,在聊天界面发送文件报错cors错误。

@theorix
Copy link
Collaborator

theorix commented Sep 6, 2021

在Network里看下上面的文件请求的OPTIONS请求的服务器返回呢

@spencer17x
Copy link
Author

image
image

@spencer17x
Copy link
Author

image

@theorix
Copy link
Collaborator

theorix commented Sep 6, 2021

改好了 @spencer17x

@spencer17x
Copy link
Author

image
有些显示还是报403,
curl如下:
curl 'https://chat-file-chatroom-1-3.oss-cn-beijing.aliyuncs.com/chat_image_c26e892c-bceb-41eb-9a55-6d885eed5656?Expires=1630915562&OSSAccessKeyId=LTAI4FsWUXZx116ZTPtKv62D&Signature=GQlYpy1ML%2B0NRF9sjp82ztyjupk%3D&x-oss-traffic-limit=1638400'
-H 'Connection: keep-alive'
-H 'Pragma: no-cache'
-H 'Cache-Control: no-cache'
-H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
-H 'Accept: image/avif,image/webp,image/apng,image/svg+xml,image/,/*;q=0.8'
-H 'Sec-Fetch-Site: cross-site'
-H 'Sec-Fetch-Mode: no-cors'
-H 'Sec-Fetch-Dest: image'
-H 'Referer: http://localhost:3000/'
-H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8'
--compressed

@theorix
Copy link
Collaborator

theorix commented Sep 6, 2021

这个应该是文件过期了,现在聊天室文件30分钟后会过期

@spencer17x
Copy link
Author

spencer17x commented Sep 7, 2021

应该不是过期的问题,我在你们提供的demo上运行是好的,自己的demo是有问题的。代码逻辑一致。 @theorix

@spencer17x
Copy link
Author

spencer17x commented Sep 7, 2021

image
@theorix

@theorix
Copy link
Collaborator

theorix commented Sep 7, 2021

我们demo是好的,指的是我们的demo上登录后进入同一个聊天室可以看到那个文件吗。 看截图里的Expires: 1630988582 就表示过期时间是2021-09-07 12:23:02

@spencer17x
Copy link
Author

@theorix 哦哦,好的,清楚了。

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