Add HEAD route for remotes and gems remote type #148

Merged
benvin merged 4 commits from benvin/remote-head-route into master 2026-10-17 21:23:30 +11:00
Member

Remotes answer only GET, so HEAD probes get 405, and there is no RubyGems remote. Synthesized (github_*) and rewritten (npm, helm, pypi, puppet, terraform, nuget) mutable responses need the GET path for HEAD lengths to match.

  • add a HEAD route for /api/v1/remote/{name}/*; rewritten and synthesized mutable HEADs go through the GET path
  • mark rewriting providers with a ResponseRewriter capability; set Content-Length on proxied GETs
  • use the remote's upstream client for upstream HEAD
  • add a gems remote type: compact index and specs mutable, .gem and gemspec immutable
  • add gems docs, UI snippet and e2e caching case; add HEAD-vs-GET e2e checks
Remotes answer only GET, so HEAD probes get 405, and there is no RubyGems remote. Synthesized (github_*) and rewritten (npm, helm, pypi, puppet, terraform, nuget) mutable responses need the GET path for HEAD lengths to match. - add a HEAD route for /api/v1/remote/{name}/*; rewritten and synthesized mutable HEADs go through the GET path - mark rewriting providers with a ResponseRewriter capability; set Content-Length on proxied GETs - use the remote's upstream client for upstream HEAD - add a gems remote type: compact index and specs mutable, .gem and gemspec immutable - add gems docs, UI snippet and e2e caching case; add HEAD-vs-GET e2e checks
unkin-agent added 1 commit 2026-10-17 12:40:46 +11:00
Add HEAD route for remotes matching GET headers
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
3dd4acd233
Author
Member
  • internal/proxy/engine.go:385 — HEAD on an uncached mutable path reports the upstream Content-Length, but GET serves the body after prov.RewriteResponse (npm, helm, pypi, puppet, terraform), so HEAD and GET lengths differ on a miss and agree only once cached → send the HEAD through serveFetch for providers whose RewriteResponse is non-nil, or omit Content-Length on a mutable miss.
- internal/proxy/engine.go:385 — HEAD on an uncached mutable path reports the upstream Content-Length, but GET serves the body after prov.RewriteResponse (npm, helm, pypi, puppet, terraform), so HEAD and GET lengths differ on a miss and agree only once cached → send the HEAD through serveFetch for providers whose RewriteResponse is non-nil, or omit Content-Length on a mutable miss.
unkin-agent added 1 commit 2026-10-17 12:59:37 +11:00
Fetch rewritten mutable responses on HEAD to match GET length
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
7769902530
benvin added 1 commit 2026-10-17 13:19:10 +11:00
Add gems remote type for RubyGems (#142)
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
9387bce560
Ruby builds fetch gems from rubygems.org directly because artifactapi has no RubyGems remote type.

- add `gems` package type proxying `https://rubygems.org`-style sources
- treat `versions`, `names`, `info/*` and `*specs.4.8.gz` as mutable, `gems/*.gem` and `quick/Marshal.4.8/*.gemspec.rz` as immutable
- serve `api/v1/*.json` as `application/json`
- add a gem/bundler usage snippet to the UI and a gems e2e caching case

Requires unkin/artifactapi#148 (HEAD route; RubyGems probes `HEAD /versions`).

Reviewed-on: #142
Co-authored-by: unkin-agent <unkin-agent@unkin.net>
Co-committed-by: unkin-agent <unkin-agent@unkin.net>
unkin-agent added 1 commit 2026-10-17 17:22:22 +11:00
Merge master into benvin/remote-head-route
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
b52165c985
unkin-agent changed title from Add HEAD route for remotes to Add HEAD route for remotes and gems remote type 2026-10-17 17:22:28 +11:00
Author
Member

No findings.

No findings.
benvin merged commit ad72c3d630 into master 2026-10-17 21:23:30 +11:00
benvin deleted branch benvin/remote-head-route 2026-10-17 21:23:30 +11:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/artifactapi#148