add rootPath option to support running web behind reverse proxy#681
Conversation
… clients correct websocket path)
|
How does the variable |
There was a problem hiding this comment.
Pull request overview
This PR introduces a new rootPath configuration option intended for deployments where web is served behind a reverse proxy under a path prefix, and exposes that prefix to clients via /_socket/info.js so WebSocket clients can connect using the correct public path.
Changes:
- Add
rootPathto adapter configuration defaults/types and expose it assocketPathin/_socket/info.js. - Add
rootPathinput to the Admin “Additionally” tab and provide i18n strings. - Update built frontend/admin entrypoints to reference newly built asset bundles.
Reviewed changes
Copilot reviewed 17 out of 28 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/main.ts |
Adds getSocketPath() and emits socketPath in getInfoJs() for clients. |
build/main.js |
Built output reflecting the new getSocketPath() and socketPath emission. |
build/main.d.ts |
Type declarations updated for the new method. |
src/types.d.ts |
Adds rootPath to WebAdapterConfig. |
io-package.json |
Adds rootPath default value to native config. |
src-admin/src/Tabs/Additionally.tsx |
Adds Admin UI field for editing rootPath. |
src-admin/src/i18n/*.json |
Adds rootPath / rootPath_hint translations. |
www/index.html |
Updates hashed web bundle reference. |
src-www/build/index.html |
Updates hashed web bundle reference in build source. |
admin/index_m.html |
Updates hashed admin bundle reference. |
Files not reviewed (1)
- build/main.js: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `var socketUrl = "${this.socketUrl}";`, | ||
| `var socketPath = "${this.getSocketPath()}";`, | ||
| `var socketSession = "";`, |
There was a problem hiding this comment.
yeah, also got this recommendation.
I followed the existing pattern of socketUrl.
Not sure, but if the extra stringify should be added, it should be added for both (like copilot suggests)
| `var socketUrl = "${this.socketUrl}";`, | ||
| `var socketPath = "${this.getSocketPath()}";`, | ||
| `var socketSession = "";`, |
It's used inside the socket-client. Also added a bit of explanation in the Admin-PR. See "#### Technical details (only relevant for devs)" |
|
@copilot resolve the merge conflicts in this pull request |
Docs for: ioBroker/ioBroker.web#681, ioBroker/socket-client#60 Also moved the reverse proxy doc to a seperate file, as it got quite long. Still draft for now until new version of web / echarts exists to fill in correct minimum versions into table. Co-authored-by: Bluefox <dogafox@gmail.com>
|
Thx for review and merge ❤️ |
tell clients correct websocket root path to use to connect.
Everything only applies when user actually configures the option. So should not be possible to break anything existing.
Doc in Admin Readme will follow.