Add HEAD route for remotes #148

Open
unkin-agent wants to merge 3 commits from benvin/remote-head-route into master
Member

Remotes answer only GET, so clients that probe with HEAD get 405. Answering HEAD from store metadata or an upstream HEAD is wrong for remotes that synthesize (github_rpm, github_deb, github_alpine) or rewrite (npm, helm, pypi, puppet, terraform, nuget) mutable responses.

  • add a HEAD route for /api/v1/remote/{name}/*
  • serve HEAD for synthesized and rewritten mutable responses through the GET path, body discarded
  • mark rewriting providers with a ResponseRewriter interface
  • set Content-Length on proxied GET responses
  • use the remote's configured upstream client for upstream HEAD
  • add e2e checks that HEAD matches GET for nuget, github_rpm and uncached npm
Remotes answer only GET, so clients that probe with HEAD get 405. Answering HEAD from store metadata or an upstream HEAD is wrong for remotes that synthesize (github_rpm, github_deb, github_alpine) or rewrite (npm, helm, pypi, puppet, terraform, nuget) mutable responses. - add a HEAD route for /api/v1/remote/{name}/* - serve HEAD for synthesized and rewritten mutable responses through the GET path, body discarded - mark rewriting providers with a ResponseRewriter interface - set Content-Length on proxied GET responses - use the remote's configured upstream client for upstream HEAD - add e2e checks that HEAD matches GET for nuget, github_rpm and uncached npm
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>
All checks were successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Required
Details
ci/woodpecker/pr/test Pipeline was successful
Required
Details
ci/woodpecker/pr/build Pipeline was successful
Required
Details
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin benvin/remote-head-route:benvin/remote-head-route
git checkout benvin/remote-head-route
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