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

feat(s3): support custom host presign #7699

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

KirCute
Copy link
Contributor

@KirCute KirCute commented Dec 22, 2024

Add a boolean addition EnableCustomHostPresign to determine whether to attach the sign when using the custom host.

  • Previous behavior (taking Aliyun OSS as an example):
    • Download link without custom host (using internal endpoint):
      https://<bucket-name>.oss-cn-beijing-internal.aliyuncs.com/<filename>?X-Amz-Algorithm=***&X-Amz-Credential=***...
      
    • Download link within custom host (using external endpoint, the following link is invalid):
      https://<bucket-name>.oss-cn-beijing.aliyuncs.com/<filename>
      
  • Current behavior when EnableCustomHostPresign is false: Same as previous
  • Current behavior when EnableCustomHostPresign is true:
    • Download link within custom host (using external endpoint, the following link is valid):
      https://<bucket-name>.oss-cn-beijing.aliyuncs.com/<filename>?X-Amz-Algorithm=***&X-Amz-Credential=***...
      

Closes #7696

@KirCute KirCute mentioned this pull request Dec 22, 2024
4 tasks
@MasterKe2003
Copy link

测试了不行
image

@KirCute
Copy link
Contributor Author

KirCute commented Dec 22, 2024

测试了不行 image

CustomHost要填完整的<bucket-name>-oss-cn-hangzhou.aliyuncs.com,你没有bucket名称。
以及新加的下面那个选项要打开,英文是 Enable custom host presign,中文是怎么翻出来的我还没搞懂所以我也不知道它会翻成什么

@MasterKe2003
Copy link

可以了,下载速度很快,那比如这种预览还是从服务器转发的吧
image

@KirCute
Copy link
Contributor Author

KirCute commented Dec 22, 2024

可以了,下载速度很快,那比如这种预览还是从服务器转发的吧 image

还是走的本地代理,跟之前一样

@KirCute
Copy link
Contributor Author

KirCute commented Dec 22, 2024

可以了,下载速度很快,那比如这种预览还是从服务器转发的吧 image

不对,我刚又试了一下,好像预览也是走302的,但我记得今天调的时候预览好像是走本地代理的,我当时还觉得挺奇怪的,要不你还是自己试一下预览到底是怎么搞的吧。总之预览我没单独改,按理来说之前是什么样的现在也应该是什么样的

@MasterKe2003
Copy link

可以了,下载速度很快,比如这种预览还是从服务器转发的吧图像

如果,我刚又试了一下,想要预览也是走302的,但我记得今天调的时候预览想要是走本地代理的,我当时还觉得挺奇怪的,要不你还是自己试一下预览到底是怎么回事搞的吧

预览确实也是302,如果要开web代理的话还是会被服务器带宽限制

@KirCute
Copy link
Contributor Author

KirCute commented Dec 22, 2024

奥,我明白了,只有文本文件预览无论如何都会走本地代理,我今天调的时候是用文本文件调的,刚才测的时候是用图片测的。
总之现在上传确实是走内网地址了,如果你需要预览走内网地址,下载走外网地址的话,有关资源获取的接口里就得携带这是预览还是下载的信息,关于link的接口就都得改,改动就有点太大了,如果你真的需要就再开一个issue吧,让比较核心的几个开发者评估一下能不能做。

@MasterKe2003
Copy link

奥,我明白了,只有文本文件预览无论如何都会走本地代理,我今天调的时候是用文本文件调的,刚才测的时候是用图片测的。 总之现在上传确实是走内网地址了,如果你需要预览走内网地址,下载走外网地址的话,有关资源获取的接口里就得携带这是预览还是下载的信息,关于link的接口就都得改,改动就有点太大了,如果你真的需要就再开一个issue吧,让比较核心的几个开发者评估一下能不能做。

这个没多大需求,谢谢,早点休息

@xhofe xhofe merged commit 221cdf3 into AlistGo:main Dec 25, 2024
3 checks passed
@KirCute KirCute deleted the feat/s3-custom-host-presign branch December 25, 2024 15:24
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

Successfully merging this pull request may close these issues.

对象存储内网接入
3 participants