-
Notifications
You must be signed in to change notification settings - Fork 247
Use full URL when redirecting to snapshots, for consistency with primary redirects #7373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use full URL when redirecting to snapshots, for consistency with primary redirects #7373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR changes snapshot redirect responses to use full URLs instead of relative paths, ensuring clients connect directly to the correct node rather than potentially being redirected through a load balancer. The change updates both the redirect generation logic and the client-side handling to use full URLs.
- Modifies the node frontend to generate full HTTPS URLs in redirect responses for snapshot endpoints
- Updates the snapshot fetching client code to properly handle redirect URLs using CURL's built-in redirect following
- Updates tests to validate the new full URL redirect behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/node/rpc/node_frontend.h | Generates full HTTPS URLs for snapshot redirects using node's published address |
| src/snapshots/fetch.h | Refactors redirect handling to use CURL's CURLINFO_REDIRECT_URL and follows redirects iteratively |
| src/http/curl.h | Changes URL parameter from rvalue reference to const reference for reusability |
| tests/e2e_operations.py | Updates tests to expect full URLs in redirect responses and uses path for subsequent requests |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
achamayou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This definitely goes in the right direction, but I think we want a clear error when we have an interface mismatch. Also I wonder if we can do something more efficient (see comment above).
…_precise_redirect
|
Poked the auto-merge in the hope of unsticking the CLA, but to no avail. A changelog entry would be helpful. |
…ary redirects (microsoft#7373) Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> (cherry picked from commit eda9bb8)
First change to solidify snapshot fetching, hoping to be iteratively backportable:
Change the redirect response header from
Location: /node/snapshot/XXXtoLocation: https://1.2.3.4/node/snapshot/XXX. This prevents the client returning to the load balancer and being silently redirected to a different node, and is consistent with other nodefrontend-specific redirects.Requires a frustratingly large diff, I'll justify/explain that inline.