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 问题 #13

Closed
IITII opened this issue Feb 4, 2023 · 6 comments
Closed

图片 CORS 问题 #13

IITII opened this issue Feb 4, 2023 · 6 comments

Comments

@IITII
Copy link

IITII commented Feb 4, 2023

疑问

image.crossOrigin = 'Anonymous' 真的有必要吗?加了反而不能正常显示了

手动修改本地 my-lib.es.js, 去除 image.crossOrigin = 'Anonymous' 可以正常显示

image.crossOrigin = 'Anonymous' // 支持跨域图片

问题截图

image

环境

nodejs 16.x.x
"vue-waterfall-plugin-next": "^2.1.11",

后端是 moleculer 起的 api 和 file server,允许跨域,跨域api可以正常调用

网上讨论

https://segmentfault.com/q/1010000008648867

@IITII IITII mentioned this issue Feb 4, 2023
@xjpe
Copy link

xjpe commented Apr 10, 2023

同样问题,解决了吗

@IITII
Copy link
Author

IITII commented Apr 10, 2023 via email

@heikaimu
Copy link
Owner

那个有点儿粗暴了,一般情况下,你的图片存储服务器都应该是会添加CORS的,我把跨域改成参数吧,默认开启

@heikaimu
Copy link
Owner

v2.2.1已添加跨域参数

@xjpe
Copy link

xjpe commented Apr 10, 2023

直接nginx又做了层代理。。

@IITII
Copy link
Author

IITII commented Apr 10, 2023

实际上 我试过 下面两种方式, 都允许跨域访问, 允许以任意形式正常访问.
但是因为这个 image.crossOrigin = 'Anonymous' 的操作, 导致请求直接被浏览器拒绝了, 后端日志里面都看不见请求.(有点多此一举)

  • 后端是 moleculer 起的 api 和 file server,允许跨域,跨域api可以正常调用
  • python http.server

而且 OOS 一般开的是 header 验证吧, 验证下 Refer... @heikaimu

@IITII IITII closed this as completed Apr 17, 2023
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