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

S3 兼容策略中含有点(.)字符储存桶的问题 #2059

Open
cxplay opened this issue Apr 1, 2024 · 0 comments
Open

S3 兼容策略中含有点(.)字符储存桶的问题 #2059

cxplay opened this issue Apr 1, 2024 · 0 comments

Comments

@cxplay
Copy link

cxplay commented Apr 1, 2024

相关问题: 针对AWS S3 API兼容性问题 · Issue #1559 · cloudreve/Cloudreve

根据 AWS S3 储存桶的命名规则: Bucket naming rules - Amazon Simple Storage Service

储存桶命名可以使用带有 . (小数点) 的字符, 但是使用带点字符后将无法使用主机格式路径访问文件, 因为这与 SSL 证书的许可域名发生冲突.

在 Cloudreve v3.8.4 中, 如果 S3 储存策略中的储存桶名称中含有点字符也将无法使用主机名格式的 HTTPS Endpoint 上传文件, 会强制使用路径格式. 如果使用 HTTP Endpoint 可以顺利使用主机名格式上传, 但是会遇到 HTTP 资源与 HTTPS 资源混用而又被浏览器安全策略禁止.

在使用 HTTPS Endpoint 的设置后使用路径格式, 生成直接链接时又会遇到 #1559 问题, 即直接链接中存在多余的储存桶名称, 导致设置 CDN 加速域名后生成的链接实际无效. 生成的直接链接为: https://cdn.example.com + /BUCKET/path/to/files.ext.

因此为针对这种情况, 建议:

  • 在使用主机名优先的储存策略下, 完全放开 CDN 加速域名的前缀设置, 因为只需要设置为 https:/ 为前缀就可以(不太优雅)地解决这个问题. 生成的直接链接则为: https:/ + /path/to/files.ext.
  • 在使用主机名优先的储存策略下, 可选不设置根路径 /. 生成的直接链接则为: https:// + BUCKET/path/to/files.ext.
  • 避免流量直传, 可设置从主机中转流量上传, 以此绕开浏览器 HTTPS 和 HTTP 资源策略问题. (这个解决办法也应该作为选择支持下载流量从主机中转的策略.)
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

1 participant