Skip to content

Do not send the default port in the Host header - #485

Merged
mpociot merged 1 commit into
masterfrom
fix-default-port-in-host-header
Sep 17, 2026
Merged

mpociot merged 1 commit into
masterfrom
fix-default-port-in-host-header

Conversation

@sschlein

Copy link
Copy Markdown
Contributor

Sharing an HTTPS site (e.g. expose share https://mysite.test or herd share on a secured site) sent Host: mysite.test:443 to the local app. WordPress treats that as a non-canonical URL and answers every request with a 301 to the local domain, so the tunnel was unusable. For the same reason, Location headers were never rewritten for HTTPS shares, because the redirect target mysite.test does not contain mysite.test:443.

The Host header is now taken from the request URI, which omits the default port of its scheme, and Location matching ignores the :443 that Expose appends itself.

Why this does not break other setups:

  • The connection target is unchanged; only the header is normalized. It now matches what every browser sends.
  • Non-default ports (:8443, localhost:8080) are kept in the Host header and still rewritten in Location.
  • HTTP shares behave exactly as before.
  • Client-only change, no protocol change, works with all existing servers.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mpociot
mpociot merged commit 135c728 into master Sep 17, 2026
12 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.

2 participants