Skip to content

v0.2.4

Choose a tag to compare

@github-actions github-actions released this 27 Aug 05:40
· 1 commit to main since this release
v0.2.4
bfd2984

场景

  • 部分目录转发 / 反向代理类 S3 站点,桶根只有在带尾斜杠时才直接应答 S3 列举;
    客户端按 S3 惯例发出不带尾斜杠的桶根请求(/bucket)时,站点 301 到一个内部端口
    (Web 应用端口,不提供 S3 API)→ 客户端跟随跳转后得到 404。浏览器看不出问题,
    因为它访问的本来就是带斜杠的地址。

修复

  • s3x 客户端新增重定向策略 slashPreservingRedirect:当 3xx 只是给路径追加
    尾斜杠、但同时改写了主机/端口/协议
    (内部端口跳转)时,把目标改写回原始 origin
    • 尾斜杠并跟随——命中该类网关的桶根列出恢复正常;其余重定向(同源跳转、区域
      跳转等)保持 Go 默认行为(含 10 次上限),不受影响
  • 新增两个单测:quirk 场景改写验证 + 普通同源跳转不受影响的回归

v0.2.4 — fix 404 listing on a class of path-forwarded gateway roots

Scenario

  • Some path-forwarded / reverse-proxied S3 sites only answer bucket listings
    when the bucket root carries a trailing slash. A client sending the
    conventional slash-less root (/bucket) is 301'd to an internal port (a web
    app that does not serve the S3 API), and following the redirect yields 404.
    Browsers never hit this because users open the slashed URL.

Fix

  • The s3x client now uses slashPreservingRedirect: when a 3xx merely
    appends a trailing slash but also rewrites host/port/scheme (internal-port
    redirect), the target is rewritten back to the original origin with the
    slash appended — bucket-root listings on such gateways work again. All
    other redirects (same-origin, regional, ...) keep Go's default policy
    including the 10-redirect cap
  • Two new unit tests: the quirk rewrite + a same-origin regression case