Repository navigation
Add HTTP->HTTPS redirect listener on port 80 - #31
Merged
Merged
Conversation
Browsers resolve a bare hostname to http://, so with nothing on port 80 the natural thing to type gives ERR_CONNECTION_REFUSED while the server sits on 443. Adds a redirect-only listener, gated on actually being able to bind port 80 (not just probing for an existing listener, since a bind failure inside Start-PodeServer is fatal to the whole server). Falls back with an explanatory warning when port 80 isn't available. Only kicks in at the default HTTPS port 443 - an explicit -Port means claiming 80 too would be a surprising side effect. Verified live: started the server, confirmed a plain HTTP request to strongbox.local:80 gets a 302 to https://strongbox.local/, HTTPS itself still works, and a spoofed Host header falls back to the configured hostname instead of being reflected into Location.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
http://, so with nothing on port 80 the natural thing to type givesERR_CONNECTION_REFUSEDwhile the server sits on 443.Start-PodeServeris fatal to the whole server.-Portis passed, since claiming port 80 too would be a surprising side effect of an unrelated choice.Hostheader (so the cert always matches the address bar), with a guard against reflecting an unrecognized host intoLocation(open-redirect protection).Test plan
strongbox.localcert + hosts entry on this machine) and confirmed live:http://strongbox.local->302tohttps://strongbox.local/https://strongbox.localstill responds200Host: evil.example.comheader falls back to the configured hostname instead of being reflected intoLocationInvoke-Pester -Path Tests/Strongbox.Tests.ps1- 43 passed, 0 failed (no dedicated coverage plan for this script, matching the existing gap forui/Start-StrongboxUi.ps1and the sync server).