Skip to content

Conversation

@eddyashton
Copy link
Member

First change to solidify snapshot fetching, hoping to be iteratively backportable:

Change the redirect response header from Location: /node/snapshot/XXX to Location: 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.

@eddyashton eddyashton requested a review from a team as a code owner October 17, 2025 15:24
Copilot AI review requested due to automatic review settings October 17, 2025 15:24
Copy link
Contributor

Copilot AI left a 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>
Copy link
Member

@achamayou achamayou left a 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).

@eddyashton eddyashton added this pull request to the merge queue Oct 21, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 21, 2025
@eddyashton eddyashton enabled auto-merge October 21, 2025 14:40
@achamayou achamayou disabled auto-merge October 21, 2025 16:51
@achamayou achamayou enabled auto-merge October 21, 2025 16:51
@achamayou achamayou added auto-backport Automatically backport this PR to LTS branch 6.x-todo PRs which should be backported to 6.x labels Oct 21, 2025
@achamayou
Copy link
Member

Poked the auto-merge in the hope of unsticking the CLA, but to no avail. A changelog entry would be helpful.

@eddyashton eddyashton disabled auto-merge October 22, 2025 08:20
@eddyashton eddyashton enabled auto-merge October 22, 2025 08:20
@eddyashton eddyashton added this pull request to the merge queue Oct 22, 2025
Merged via the queue into microsoft:main with commit eda9bb8 Oct 22, 2025
21 checks passed
@eddyashton eddyashton deleted the snapshot_precise_redirect branch October 22, 2025 09:47
eddyashton added a commit to eddyashton/CCF that referenced this pull request Dec 3, 2025
…ary redirects (microsoft#7373)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
(cherry picked from commit eda9bb8)
@eddyashton eddyashton added the backported This PR was successfully backported to LTS branch label Dec 3, 2025
eddyashton added a commit that referenced this pull request Dec 3, 2025
…, for consistency with primary redirects (#7373) (#7503)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.x-todo PRs which should be backported to 6.x auto-backport Automatically backport this PR to LTS branch backported This PR was successfully backported to LTS branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants