Skip to content

fix: preserve scheme when forwarding host-header requests, refuse self-forwarding - #4

Merged
rohansx merged 1 commit into
rohansx:mainfrom
Renegatto:alexey/preserve-protocol
Sep 30, 2026
Merged

rohansx merged 1 commit into
rohansx:mainfrom
Renegatto:alexey/preserve-protocol

Conversation

@Renegatto

Copy link
Copy Markdown
Contributor

Preserve scheme

Host-header fallback routing hardcoded https for every upstream URL, so any plain-http request to the proxy failed with "io error: error sending request for url (https://...)". Resolve the upstream with the scheme the client actually used (URI scheme, defaulting to http since the daemon listens on plain HTTP) and preserve the port from the Host header, which was silently dropped before.

Refuse self-forwarding

Refuse to forward requests that resolve back to the daemon's own listen address (a base-URL override without a provider prefix would otherwise loop through the proxy until the loop guard trips), returning a clear error instead.

Fixes #3

…t https

Host-header fallback routing hardcoded https for every upstream URL, so
any plain-http request to the proxy failed with "io error: error sending
request for url (https://...)". Resolve the upstream with the scheme the
client actually used (URI scheme, defaulting to http since the daemon
listens on plain HTTP) and preserve the port from the Host header, which
was silently dropped before.

Also refuse to forward requests that resolve back to the daemon's own
listen address (a base-URL override without a provider prefix would
otherwise loop through the proxy until the loop guard trips), returning
a clear error instead.
@rohansx
rohansx self-requested a review August 13, 2026 18:25
@rohansx
rohansx merged commit c0c8d09 into rohansx:main Sep 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

io error: error sending request for url

2 participants