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

egg-oss下载文件 #4601

Closed
brucewar opened this issue Feb 3, 2021 · 4 comments
Closed

egg-oss下载文件 #4601

brucewar opened this issue Feb 3, 2021 · 4 comments

Comments

@brucewar
Copy link

brucewar commented Feb 3, 2021

ali-oss官方提供的例子是下载到本地(验证通过),我的需求是通过egg.js转发到前端,通过如下代码,发现前端报错“网页可能暂时无法连接,或者它已永久性地移动到了新网址。”,后台nginx报404.

const result = await this.ctx.oss.getStream('object-name');
this.ctx.body = result.stream;
@atian25
Copy link
Member

atian25 commented Feb 3, 2021

为啥不直接给对应的 cdn 地址给前端?

@egg-bot
Copy link

egg-bot commented Feb 3, 2021

Hello @brucewar. Please provide a reproducible example following the instruction.

Issues labeled by Need Reproduce will be closed if no activities in 7 days.


@brucewar,请根据这个说明提供最小可复现代码。

如果在 7 天内没有进展会被自动关闭。

@brucewar
Copy link
Author

brucewar commented Feb 3, 2021

为啥不直接给对应的 cdn 地址给前端?

因为我的那个bucket是私有的,不想让前端直接访问

@atian25
Copy link
Member

atian25 commented Feb 3, 2021

可以根据报错自行排查下,或者提供可复现的最小仓库。

getStream 我没怎么用过,一般就直接用 cdn 的地址,代理的话也可以是 curl 这个 cdn 地址来代理一层。

@brucewar brucewar closed this as completed Feb 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants