From b70ed94e89460f288a007c165ffb28cea310fafe Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Thu, 28 May 2020 11:52:19 -0400 Subject: [PATCH 1/2] Support ws under api root Signed-off-by: 1000TurquoisePogs --- bootstrap/src/uri/mvd-uri.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bootstrap/src/uri/mvd-uri.ts b/bootstrap/src/uri/mvd-uri.ts index 3abf4ed85..f9a56d14c 100644 --- a/bootstrap/src/uri/mvd-uri.ts +++ b/bootstrap/src/uri/mvd-uri.ts @@ -138,7 +138,15 @@ export class MvdUri implements ZLUX.UriBroker { + `services/${serviceName}/${version}/${relativePath}`; // This is a workaround for the mediation layer not having a dynamic way to get the websocket uri for zlux // Since we know our uri is /ui/v1/zlux/ behind the api-layer we replace the ui with ws to get /ws/v1/zlux/ - return proxy_mode ? uri.replace('/ui/', '/ws/') : uri; + if (proxy_mode) { + if (uri.startsWith('/api/')) { + return uri.replace('/api/', '/ws/'); + } else if (uri.startsWith('/ui/')) { + return uri.replace('/ui/', '/ws/'); + } + } else { + return uri; + } } /** From 37890ac0c773d4d325cf301a6cc284bc1eb28d36 Mon Sep 17 00:00:00 2001 From: 1000TurquoisePogs Date: Thu, 28 May 2020 11:54:51 -0400 Subject: [PATCH 2/2] Else instead of else if, best-attempt at an unlikely edge case Signed-off-by: 1000TurquoisePogs --- bootstrap/src/uri/mvd-uri.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap/src/uri/mvd-uri.ts b/bootstrap/src/uri/mvd-uri.ts index f9a56d14c..e3daa38bd 100644 --- a/bootstrap/src/uri/mvd-uri.ts +++ b/bootstrap/src/uri/mvd-uri.ts @@ -141,7 +141,7 @@ export class MvdUri implements ZLUX.UriBroker { if (proxy_mode) { if (uri.startsWith('/api/')) { return uri.replace('/api/', '/ws/'); - } else if (uri.startsWith('/ui/')) { + } else { return uri.replace('/ui/', '/ws/'); } } else {