Skip to content

Commit 708b904

Browse files
authored
Support same-origin baseUrl in WebSocketService (#4313)
* Support for changes in xh/hoist-dev-utils#63 to support Webpack proxying of requests back to Grails server during local development, with planned release as hoist-dev-utils v12. * Backwards compatible with existing hoist-dev-utils and `XH.baseUrl` values.
1 parent 5604e22 commit 708b904

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
## 84.0.0-SNAPSHOT - unreleased
44

5+
### ⚙️ Technical
6+
7+
* Updated `WebSocketService` to support same-origin `baseUrl` values (e.g. `/api/`). Previously
8+
assumed a cross-origin `baseUrl` in dev mode. Required for compatibility with the new
9+
webpack-dev-server proxy in `@xh/hoist-dev-utils` v12.
510

611
## 83.0.1 - 2026-03-25
712

svc/WebSocketService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export class WebSocketService extends HoistService {
345345
private buildWebSocketUrl() {
346346
const protocol = window.location.protocol == 'https:' ? 'wss:' : 'ws:',
347347
endpoint = `xhWebSocket?${this.METADATA_FOR_HANDSHAKE.map(key => `${key}=${XH[key]}`).join('&')}`;
348-
return XH.isDevelopmentMode
348+
return XH.baseUrl.includes('//')
349349
? `${protocol}//${XH.baseUrl.split('//')[1]}${endpoint}`
350350
: `${protocol}//${window.location.host}${XH.baseUrl}${endpoint}`;
351351
}

0 commit comments

Comments
 (0)