Skip to content

fix(share): collapse https asset URLs on LAN share#231

Merged
geodro merged 2 commits intomainfrom
fix/share-asset-https-scheme
Apr 22, 2026
Merged

fix(share): collapse https asset URLs on LAN share#231
geodro merged 2 commits intomainfrom
fix/share-asset-https-scheme

Conversation

@geodro
Copy link
Copy Markdown
Owner

@geodro geodro commented Apr 21, 2026

LAN share serves over plain HTTP but Laravel emits asset URLs as https://<lan-ip>:9100/build/app.css (when APP_URL forces https and X-Forwarded-Host gets honored). The body rewriter only swapped the origin domain, so those https URLs slipped through, the browser opened TLS to the plain-HTTP proxy, and every asset failed with ERR_SSL_PROTOCOL_ERROR while the page itself loaded fine.

New rewriteLANShareBody helper does three passes (https://domain and http://domain to http://lanHost, plus https://lanHost to http://lanHost) so the asset URLs Laravel emits ahead of time get downgraded too. lerd share (cloudflared, ngrok, serveo, localhost.run) is left alone because those tunnels do serve over HTTPS.

Tests cover all three paths.

geodro added 2 commits April 21, 2026 20:23
The dashboard's LAN share proxy listens on plain HTTP. When Laravel
honored the share's X-Forwarded-Host but APP_URL forced https, it
emitted `https://<lan-ip>:9100/build/app.css` directly into the page;
the existing rewriter only swapped origin-domain references so the
asset URL never matched and the browser hit the plain-HTTP proxy over
TLS, getting ERR_SSL_PROTOCOL_ERROR for every asset while the page
itself still loaded (the user opened it via http://).

Add a third pass that downgrades any `https://<lanHost>` references to
`http://<lanHost>` after the domain rewrite. `lerd share` (cloudflared,
ngrok, serveo, localhost.run) is unaffected: those tunnels serve over
HTTPS and want their `https://<tunnel-host>` URLs preserved.
@geodro geodro merged commit 4c11c14 into main Apr 22, 2026
3 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.

1 participant