Skip to content

add rootPath option to support running web behind reverse proxy#681

Merged
GermanBluefox merged 8 commits into
ioBroker:masterfrom
SimonFischer04:fix-reverse-proxy
Jun 12, 2026
Merged

add rootPath option to support running web behind reverse proxy#681
GermanBluefox merged 8 commits into
ioBroker:masterfrom
SimonFischer04:fix-reverse-proxy

Conversation

@SimonFischer04

@SimonFischer04 SimonFischer04 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

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.

@GermanBluefox

GermanBluefox commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

How does the variable window.socketPath used in GUI?

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 rootPath to adapter configuration defaults/types and expose it as socketPath in /_socket/info.js.
  • Add rootPath input 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.

Comment thread src/main.ts
Comment on lines 1139 to 1141
`var socketUrl = "${this.socketUrl}";`,
`var socketPath = "${this.getSocketPath()}";`,
`var socketSession = "";`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Comment thread build/main.js
Comment on lines 923 to 925
`var socketUrl = "${this.socketUrl}";`,
`var socketPath = "${this.getSocketPath()}";`,
`var socketSession = "";`,
@SimonFischer04

Copy link
Copy Markdown
Contributor Author

How does the variable window.socketPath used in GUI?

It's used inside the socket-client.
See linked related PR: ioBroker/socket-client#60

Also added a bit of explanation in the Admin-PR. See "#### Technical details (only relevant for devs)"
ioBroker/ioBroker.admin#3503

@GermanBluefox

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

@GermanBluefox GermanBluefox merged commit 8ee98c9 into ioBroker:master Jun 12, 2026
1 check passed
GermanBluefox added a commit to ioBroker/ioBroker.admin that referenced this pull request Jun 12, 2026
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>
@SimonFischer04

Copy link
Copy Markdown
Contributor Author

Thx for review and merge ❤️

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.

3 participants