feat: S3-compliant 301 redirects for renamed accounts#124
Draft
feat: S3-compliant 301 redirects for renamed accounts#124
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add pure-logic functions for building redirect paths, generating S3 PermanentRedirect XML responses, and extracting path segments for account rename redirects. Includes 16 tests covering all functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add ApiResponse enum and cached_fetch_with_redirect to handle HTTP 301 responses from the Source API, enabling the cache layer to distinguish between normal data and redirect info for renamed accounts. Also add Serialize derive to RedirectInfo for cache serialization. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Insert redirect short-circuit between path rewriting and gateway dispatch in lib.rs. When the API reports an account rename, return a 301 with S3 PermanentRedirect XML body and Location header instead of proxying. Also wire up redirect module imports and remove dead_code annotations from registry redirect methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add #[serde(deny_unknown_fields)] to RedirectInfo to prevent false positive redirect detection on cache hits - Hoist registry creation above redirect check to avoid duplicate instantiation - Only check product-level redirects in lib.rs; account-only requests are handled by AccountListHandler to avoid redundant API calls - Replace .unwrap() with graceful error handling for Location header parsing in AccountListHandler - Remove unnecessary #[allow(dead_code)] from redirect-aware cache functions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🚀 Latest commit deployed to https://source-data-proxy-pr-124.source-coop.workers.dev
|
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
{"redirect_to": "new-account"}) and returns redirect withLocationheader and S3 XML error body/{old-account}/{product}/...) caught in fetch handler before gateway dispatch/{old-account}?list-type=2) caught inAccountListHandlerDesign
Key architectural decisions:
#[serde(deny_unknown_fields)]onRedirectInfoprevents false positive redirect detection on cache hitsTest plan
redirectmodule (URL rewriting, XML generation, path parsing)cargo clippyclean onwasm32-unknown-unknownCloses source-cooperative/source.coop#277
🤖 Generated with Claude Code