diff --git a/bootstrap/src/uri/mvd-uri.ts b/bootstrap/src/uri/mvd-uri.ts index ae1a347c2..1082cb637 100644 --- a/bootstrap/src/uri/mvd-uri.ts +++ b/bootstrap/src/uri/mvd-uri.ts @@ -13,7 +13,7 @@ import { PluginManager } from 'zlux-base/plugin-manager/plugin-manager' const uri_prefix = window.location.pathname.split('ZLUX/plugins/')[0]; -// const proxy_mode = (uri_prefix !== '/') ? true : false; // Tells whether we're behind API layer (true) or not (false) +const proxy_mode = (uri_prefix !== '/') ? true : false; // Tells whether we're behind API layer (true) or not (false) export class MvdUri implements ZLUX.UriBroker { rasUri(uri: string): string { @@ -108,8 +108,11 @@ export class MvdUri implements ZLUX.UriBroker { } const protocol = window.location.protocol; const wsProtocol = (protocol === 'https:') ? 'wss:' : 'ws:'; - return `${wsProtocol}//${window.location.host}${this.pluginRootUri(plugin)}` + const uri = `${wsProtocol}//${window.location.host}${this.pluginRootUri(plugin)}` + `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; } /**