GitHub connector: gateway drops `Location` on 302 responses, making archive endpoints unusable

未关闭
#227 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
github
领域
api, backend

调研方向

从文档中的 gateway URL 开始,使用 /tarball 或 /zipball endpoint 重现 302,然后将其与正常工作的 /contents/Gemfile 请求进行比较。payload 没有列出源文件或测试,因此请定位处理 provider response headers 的 gateway 实现。完成标准是 GitHub 的 Location 能传递到客户端,使 curl -L 可以获取 archive。

由索引模型根据 Issue 内容生成。

描述

Summary

Requests proxied through a GitHub connector lose the Location header on 302 responses. GitHub's repository-archive endpoints (/tarball, /zipball) always redirect to codeload.github.com, so through the gateway they return a bodyless 302 with nothing to follow, and the archive can never be retrieved.

Reproduction

From inside a Sprite authorised for a GitHub connector whose access policy allows the path:

curl -sS -D - -o /dev/null \
  "https://api.sprites.dev/v1/gateway/github/<conn_id>/repos/<owner>/<repo>/tarball/<ref>"

Response headers:

HTTP/2 302
date: Wed, 19 Aug 2026 07:18:02 GMT
content-length: 0
vary: accept-encoding
cache-control: max-age=0, private, must-revalidate
x-ratelimit-remaining: 4860
content-type: text/html;charset=utf-8; charset=utf-8
server: Fly/d778e1ff4 (2026-08-17)
via: 2 fly.io
fly-request-id: 01M0CE4P4JB2SPJ4T4V6BVHHR7-sin

There is no Location. curl -L consequently follows nothing and writes a zero-byte file, exiting 0.

The same connector against a non-redirecting endpoint works as expected:

curl -sS "https://api.sprites.dev/v1/gateway/github/<conn_id>/repos/<owner>/<repo>/contents/Gemfile"
{"name":"Gemfile","path":"Gemfile","sha":"...","size":3571, ...}

Expected

GitHub's Location (a pre-signed codeload.github.com URL) is passed through so clients can follow the redirect.

Impact

/tarball, /zipball and any other redirecting GitHub endpoint are unreachable through a connector. A connector is not a git transport either, so there is currently no way to get a private repository's source into a Sprite using one. The only redirect-free alternative is fetching blobs individually through /contents, which for a ~3,900-file repository is close to the entire hourly rate limit for a single clone.

Possibly related

Accept: application/vnd.github.raw on a /contents/ request through the gateway returns 406 Not Acceptable. The identical request without that header succeeds and returns JSON, which suggests request headers are not forwarded to the provider.

Environment

sprite CLI 2026-08-14, default base image (Ubuntu 26.04), OAuth GitHub connector with repo scope.

主要语言
MDX
星标
53
派生
5
平均合并
1 天 15 小时
30 天内合并 PR
4

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

superfly/sprites-docs 的其他 Issue

查看 superfly/sprites-docs 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。