Skip to content

Commit cb8d64c

Browse files
committed
make connection to websocket relative path
1 parent 53300b2 commit cb8d64c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/client/packages/idom-app-react/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function mount(mountPoint) {
44
const serverInfo = new LayoutServerInfo({
55
host: document.location.hostname,
66
port: document.location.port,
7-
path: "/",
7+
path: "../",
88
query: queryParams.user.toString(),
99
secture: document.location.protocol == "https",
1010
});

src/client/packages/idom-client-react/src/server.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,20 @@ export function LayoutServerInfo({ host, port, path, query, secure }) {
2323
const httpProtocol = "http" + (secure ? "s" : "");
2424

2525
const uri = host + ":" + port;
26+
path = new URL(path, document.baseURI).pathname;
2627
const url = (uri + path).split("/").slice(0, -1).join("/");
2728

2829
const wsBaseUrl = wsProtocol + "://" + url;
2930
const httpBaseUrl = httpProtocol + "://" + url;
3031

32+
if (query) {
33+
query = "?" + query;
34+
} else {
35+
query = "";
36+
}
37+
3138
this.path = {
32-
stream: wsBaseUrl + "/stream" + "?" + query,
39+
stream: wsBaseUrl + "/stream" + query,
3340
module: (source) => httpBaseUrl + `/modules/${source}`,
3441
};
3542
}

0 commit comments

Comments
 (0)