Repository navigation
proxy: Follow multi-hop upstream redirects - #173
Merged
Merged
Conversation
Fedora COPR now redirects twice (COPR -> Red Hat Pulp -> S3), but tryMirrors followed only one redirect and passed the second 302 through to the client, so nothing was cached. Follow up to 10 redirects per mirror attempt. Reject HTTPS -> HTTP downgrades, and treat an exceeded hop limit or rejected downgrade as a failed mirror so the next one is tried (502 if none remain). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Bumps [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) from 1.76.0 to 1.81.2. - [Release notes](https://github.com/reviewdog/action-actionlint/releases) - [Commits](reviewdog/action-actionlint@320fcdd...7abf25e) --- updated-dependencies: - dependency-name: reviewdog/action-actionlint dependency-version: 1.81.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.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.
Summary
tryMirrorsfollowed only one redirect per mirror attempt. A second redirect (as Fedora COPR sends) reached the client as a 3xx, and the package never got cached.tryMirrors for each mirror, attempt rsp = forward(mirror URL) - if rsp is redirect - rsp = forward(Location) + for hop := 0; rsp is redirect; hop++ + if hop == 10 -> fail attempt, next mirror + if https -> http downgrade -> fail attempt, next mirror + rsp = forward(Location) if rsp is 200 -> returnIf every mirror fails this way the client gets
502 Bad Gateway, never a 3xx. New spec:openspec/specs/upstream-redirects/spec.md.Evidence
main'sproxy.go)Merge Danger
Door: two-way
Change is local to
tryMirrors. No config or cache format changes; a revert restores the old behavior.Blast Radius: upstream-fetching
A mirror that redirects from HTTPS to HTTP now fails instead of being followed. The proxy then tries the next mirror, or returns 502 if none is left.
🤖 Generated with Claude Code