Watch
1
0
Fork
You've already forked pkg-proxy
1
mirror of https://github.com/git-pkgs/proxy.git synced 2026-11-10 16:19:16 -05:00
Commit graph pkg-proxy/internal/handler/stale_metadata_test.go
Author SHA1 Message Date
Simon Chrzanowski
0e25e46732 Keep the stale fallback for 404 and 401/403, leave npm to #503
Serving cached metadata when the upstream refuses is documented for
generic upstreams, and GitHub rate limits are 403s, so the fallback
stays as it is. #503 handles npm's definite answers. What is left here
is the stale warning for Composer, Chef and hosted npm metadata, which
went through the rewrite cache without it.
2026-10-22 09:14:33 +02:00
Simon Chrzanowski
994a9368d1 Keep the stale warning on filtered npm version metadata
With cooldown or a version denylist, /pkg/<version> reads the filtered
packument through handleFilteredNPMVersionMetadata, which dropped the
stale flag.
2026-10-21 12:23:33 +02:00
Simon Chrzanowski
844e2ae4f3 Test that Composer metadata doesn't hide upstream 404 and 401/403 2026-10-20 21:34:07 +02:00
Simon Chrzanowski
f77d299b31 Don't hide upstream 404 and 401/403 behind stale metadata
With cache_metadata on, a failed upstream metadata fetch fell back to the
cached copy for any error. A 404 (package removed) and a 401/403 (the
proxy's credentials rejected) are definite answers, though, and serving
the old version list in their place kept them from reaching the client.
They now pass through: 404 as 404, 401/403 as 502 like other upstream
failures. Timeouts, connection errors, 5xx and 429 still fall back.

The npm, Composer and Chef handlers serve metadata through the rewrite
cache, which dropped the stale flag, so a fallback looked like a fresh
200. They now set the same Warning: 110 header as other metadata.

Fixes #499
2026-10-20 21:33:08 +02:00