File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ import {
5252 createCoreClient ,
5353 createSessionWrapper ,
5454 getAuthType ,
55+ getEnvoyPrefix ,
5556 getLoginOptions ,
5657 getSessionDetails ,
5758} from './SessionUtils' ;
@@ -170,7 +171,12 @@ function AppInit(props: AppInitProps) {
170171 navigator . userAgent
171172 ) ;
172173
173- const coreClient = createCoreClient ( ) ;
174+ const envoyPrefix = getEnvoyPrefix ( ) ;
175+ const options =
176+ envoyPrefix != null
177+ ? { headers : { 'envoy-prefix' : envoyPrefix } }
178+ : undefined ;
179+ const coreClient = createCoreClient ( options ) ;
174180 const authType = getAuthType ( ) ;
175181 log . info ( `Login using auth type ${ authType } ...` ) ;
176182 const [ loginOptions , sessionDetails ] = await Promise . all ( [
Original file line number Diff line number Diff line change 33 SessionWrapper ,
44} from '@deephaven/dashboard-core-plugins' ;
55import dh , {
6+ ConnectOptions ,
67 CoreClient ,
78 IdeConnection ,
89 LoginOptions ,
@@ -42,6 +43,11 @@ export function getAuthType(): AUTH_TYPE {
4243 }
4344}
4445
46+ export function getEnvoyPrefix ( ) : string | null {
47+ const searchParams = new URLSearchParams ( window . location . search ) ;
48+ return searchParams . get ( 'envoyPrefix' ) ;
49+ }
50+
4551/**
4652 * @returns New connection to the server
4753 */
@@ -89,12 +95,12 @@ export async function createSessionWrapper(
8995 } ;
9096}
9197
92- export function createCoreClient ( ) : CoreClient {
98+ export function createCoreClient ( options ?: ConnectOptions ) : CoreClient {
9399 const websocketUrl = getWebsocketUrl ( ) ;
94100
95101 log . info ( 'createCoreClient' , websocketUrl ) ;
96102
97- return new dh . CoreClient ( websocketUrl ) ;
103+ return new dh . CoreClient ( websocketUrl , options ) ;
98104}
99105
100106async function requestParentLoginOptions ( ) : Promise < LoginOptions > {
Original file line number Diff line number Diff line change @@ -1066,14 +1066,18 @@ export interface StorageService {
10661066 createDirectory ( path : string ) : Promise < void > ;
10671067}
10681068
1069+ export interface ConnectOptions {
1070+ headers ?: Record < string , string > ;
1071+ }
1072+
10691073export interface CoreClientContructor extends Evented {
10701074 EVENT_CONNECT : string ;
10711075 EVENT_DISCONNECT : string ;
10721076 EVENT_RECONNECT : string ;
10731077 EVENT_RECONNECT_AUTH_FAILED : string ;
10741078 EVENT_REFRESH_TOKEN_UPDATED : string ;
10751079 LOGIN_TYPE_ANONYMOUS : string ;
1076- new ( serverUrl : string ) : CoreClient ;
1080+ new ( serverUrl : string , options ?: ConnectOptions ) : CoreClient ;
10771081}
10781082
10791083export interface CoreClient extends CoreClientContructor {
You can’t perform that action at this time.
0 commit comments