fix(web): honor forwarded headers for Pico websocket URLs#2125
fix(web): honor forwarded headers for Pico websocket URLs#21259ex wants to merge 1 commit intosipeed:mainfrom
Conversation
Build Pico websocket URLs from the externally visible host and port so reverse-proxied WebUI deployments can connect through 443 without exposing the internal launcher port.
|
Heads up: this PR's changes to #1953 refactors
If #1953 merges first, this PR can likely be closed as superseded. If we want to ship the URL fix independently first, #1953 would need to rebase and drop the overlapping CC @zeed-w-beez (author of #1953) |
|
Thanks for the heads-up! I see the overlap with #1953. My intent with this PR was to provide a narrowly scoped fix for the reverse-proxy WebSocket URL issue reported in #1737. It strictly addresses the /api/pico/token URL generation, preserves the existing fallback behavior, and adds regression tests for forwarded host/port/proto handling. I'm perfectly fine with whichever direction the maintainers prefer:
Happy to rebase, adjust, or close this out depending on what works best for the project. |
|
superseded by #1953 |
📝 Description
This PR fixes Pico WebUI websocket URL generation for reverse-proxied deployments.
Before this change, the backend could return a websocket URL that exposed the internal launcher port, for example
wss://<domain>:18800/pico/ws. In reverse-proxy setups where the public WebUI is served through443or another forwarded port, the browser would try to connect to the internal port directly and fail.This change:
X-Forwarded-Host,X-Forwarded-Port, andX-Forwarded-Proto🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
Related to #1737
📚 Technical Context (Skip for Docs)
:18800gateway_host.goshould not force18800/api/pico/tokenreturns a websocket URL tied to18800wss://<domain>:18800/pico/ws, which breaks when the public endpoint is served through443or another forwarded port.🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
Validated locally with:
make checkgo test ./web/backend/apiRegression coverage added for:
X-Forwarded-Proto: httpsX-Forwarded-HostwithX-Forwarded-Port: 443X-Forwarded-HostwithX-Forwarded-Port: 8443☑️ Checklist