Skip to content

fix: fall back to GET when APKINDEX HEAD is unsupported#2282

Open
arpitjain099 wants to merge 1 commit into
chainguard-dev:mainfrom
arpitjain099:fix/apkindex-head-fallback
Open

fix: fall back to GET when APKINDEX HEAD is unsupported#2282
arpitjain099 wants to merge 1 commit into
chainguard-dev:mainfrom
arpitjain099:fix/apkindex-head-fallback

Conversation

@arpitjain099

Copy link
Copy Markdown

Some Alpine registries reject HEAD requests for APKINDEX.tar.gz with 405, which currently makes index resolution fail before we ever fetch the index.

This change treats 405 and 501 from the HEAD probe as unsupported-method responses and falls back to fetching and parsing the index via GET without etag-based HEAD caching. Other non-200 statuses still fail as before.

I also added a regression test that simulates HEAD returning 405 while GET succeeds.

Fixes #2251

Verification:

  • go test ./pkg/apk/apk -run TestGetRepositoryIndexes
  • go test ./pkg/apk/apk

@arpitjain099 arpitjain099 force-pushed the fix/apkindex-head-fallback branch 3 times, most recently from 864afa0 to df664e5 Compare June 18, 2026 13:34
Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099 arpitjain099 force-pushed the fix/apkindex-head-fallback branch from df664e5 to ea2aa6d Compare June 18, 2026 13:36
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

Successfully merging this pull request may close these issues.

Package index fetches fail if APKINDEX.tar.gz doesn't support HEAD requests (e.g. Gitea/Forgejo package repositories)

1 participant