Repository navigation
fix(maven-proxy): fetch from a Central mirror when Maven Central answers 429 or 5xx - #50
Merged
Merged
Conversation
…ers 429 or 5xx A cold cache could not fill while Central rate-limited the host: the proxy only caches a 200, so Robolectric's nativeruntime jar failed every build with 429. Central's 429 or 5xx now sends the request to MAVEN_CENTRAL_MIRROR_URL (Google's mirror of Central by default), and the mirror's copy is cached under the same key. Google Maven and the Plugin Portal are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…document its limits - The mirror lags Central, so its 404 after Central's 429/5xx is no longer cached under Central's key - Document that the mirror must serve files itself (its redirects are not followed) - Fix docs: pointing MAVEN_CENTRAL_MIRROR_URL at Central only asks Central again, it does not turn the fallback off - Test Central 503 + mirror 404; upstream_hits counts access-log lines only; Google 429 test no longer depends on earlier counts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The proxy from #47 started with an empty cache and only caches a 200. Maven Central keeps answering 429 for Robolectric's
org.robolectric:nativeruntime-dist-compat:1.0.20(165 MB), so the proxy never got a copy and passed the 429 on. Every Android build that runs unit tests failed, e.g. dodi-smart/nis-inventory-android#95 (three attempts). Central answers that file with 429 even from outside the runner host, while Google's mirror of Central serves it.Change
maven-proxy/default.conf.template:/maven2/gets its own locations. Central's 429/500/502/503/504 goes to@central_mirror(or@central_mirror_metadata, which keeps the 10-minute TTL), which fetches the same path fromMAVEN_CENTRAL_MIRROR_URL. The response is cached under the same key, so the next request is a HIT. Redirect handling is kept in those locations, since a location-levelerror_pagereplaces the server's.docker-compose.yml:MAVEN_CENTRAL_MIRROR_URL, defaulting tohttps://maven-central.storage-download.googleapis.com/maven2. Set it toMAVEN_CENTRAL_URLto turn the fallback off..env.exampledocument the fallback.Tests
tests/maven-proxy.shgains cases for these:The proxy section passes locally (OrbStack). On the previous config, 11 checks fail. The Gradle section was skipped locally (no plain gradle on PATH), and this change doesn't touch the init script.
Rollout
docker compose up -d maven-proxyon each host while the runners are idle.🤖 Generated with Claude Code