Skip to content

Reverse Proxy Support#1318

Merged
Ryang-21 merged 5 commits intomasterfrom
issue-637/reverse-proxy-support
Jan 26, 2026
Merged

Reverse Proxy Support#1318
Ryang-21 merged 5 commits intomasterfrom
issue-637/reverse-proxy-support

Conversation

@Ryang-21
Copy link
Copy Markdown
Contributor

Why

When using a reverse proxy, only the first request went through the proxy.
Subsequent requests (pagination via .next(), linked resources) used URLs
from Horizon's _links, bypassing the proxy entirely.

What

Always replace the authority and protocol of response URLs with the
configured server's values, instead of only when they're empty. From documentation it appears that the _link in Horizon responses should be all self referencing so always replacing should be safe.

Summary

  • Fixes reverse proxy support for Horizon.Server
  • All requests now use the configured server URL, not Horizon's returned URLs

Closes #637

Copilot AI review requested due to automatic review settings January 14, 2026 23:50
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Jan 14, 2026
Copy link
Copy Markdown

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 fixes reverse proxy support in the Stellar SDK's Horizon client. Previously, only the initial request used the configured server URL, while subsequent pagination and linked resource requests used URLs from Horizon's _links responses, bypassing reverse proxies entirely.

Changes:

  • Modified CallBuilder._sendNormalRequest() to always replace URL authority and protocol with configured server values
  • Added integration test verifying pagination links use configured server URL
  • Updated CHANGELOG with fix description

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/horizon/call_builder.ts Removed conditional check, now always replaces authority and protocol in URLs to ensure all requests go through configured server
test/integration/client_headers.test.ts Added comprehensive test simulating reverse proxy scenario with pagination
CHANGELOG.md Documented the fix under "Unreleased" section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 14, 2026

Size Change: -14.1 kB (-0.03%)

Total Size: 45 MB

Filename Size Change
dist/stellar-sdk-minimal.js 5.95 MB -2.53 kB (-0.04%)
dist/stellar-sdk-minimal.min.js 5.06 MB -997 B (-0.02%)
dist/stellar-sdk-no-axios.js 5.95 MB -2.53 kB (-0.04%)
dist/stellar-sdk-no-axios.min.js 5.06 MB -997 B (-0.02%)
dist/stellar-sdk-no-eventsource.js 6.2 MB -2.53 kB (-0.04%)
dist/stellar-sdk-no-eventsource.min.js 5.27 MB -997 B (-0.02%)
dist/stellar-sdk.js 6.2 MB -2.53 kB (-0.04%)
dist/stellar-sdk.min.js 5.27 MB -997 B (-0.02%)

compressed-size-action

Comment thread test/unit/server/horizon/server.test.ts Fixed
Comment thread test/unit/server/horizon/server.test.ts Fixed
@Ryang-21 Ryang-21 requested review from a team and Shaptic January 15, 2026 20:04
@Ryang-21 Ryang-21 moved this from Backlog (Not Ready) to Needs Review in DevX Jan 16, 2026
@Ryang-21 Ryang-21 requested a review from quietbits January 26, 2026 20:16
@Ryang-21 Ryang-21 merged commit 697544c into master Jan 26, 2026
10 checks passed
@Ryang-21 Ryang-21 deleted the issue-637/reverse-proxy-support branch January 26, 2026 21:54
@github-project-automation github-project-automation bot moved this from Needs Review to Done in DevX Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Links provided in network responses use a different hostname than the calling URL

4 participants