diff --git a/invokeai/frontend/web/src/app/hooks/useSocketIO.ts b/invokeai/frontend/web/src/app/hooks/useSocketIO.ts index dc2a8947fc..ad331bc385 100644 --- a/invokeai/frontend/web/src/app/hooks/useSocketIO.ts +++ b/invokeai/frontend/web/src/app/hooks/useSocketIO.ts @@ -45,7 +45,7 @@ export const useSocketIO = () => { const socketOptions = useMemo(() => { const options: Partial = { timeout: 60000, - path: '/ws/socket.io', + path: `${window.location.pathname}ws/socket.io`, autoConnect: false, // achtung! removing this breaks the dynamic middleware forceNew: true, }; diff --git a/invokeai/frontend/web/src/i18n.ts b/invokeai/frontend/web/src/i18n.ts index f0cbe40a75..89c855bcd0 100644 --- a/invokeai/frontend/web/src/i18n.ts +++ b/invokeai/frontend/web/src/i18n.ts @@ -32,7 +32,7 @@ if (import.meta.env.MODE === 'package') { fallbackLng: 'en', debug: false, backend: { - loadPath: '/locales/{{lng}}.json', + loadPath: `${window.location.href.replace(/\/$/, '')}/locales/{{lng}}.json`, }, interpolation: { escapeValue: false, diff --git a/invokeai/frontend/web/src/services/api/index.ts b/invokeai/frontend/web/src/services/api/index.ts index 1c76838db1..9679fabc3f 100644 --- a/invokeai/frontend/web/src/services/api/index.ts +++ b/invokeai/frontend/web/src/services/api/index.ts @@ -57,7 +57,9 @@ const dynamicBaseQuery: BaseQueryFn< const projectId = $projectId.get(); const rawBaseQuery = fetchBaseQuery({ - baseUrl: `${baseUrl ?? ''}/api/v1`, + baseUrl: baseUrl + ? `${baseUrl}/api/v1` + : `${window.location.href.replace(/\/$/, '')}/api/v1`, prepareHeaders: (headers) => { if (authToken) { headers.set('Authorization', `Bearer ${authToken}`); diff --git a/invokeai/frontend/web/src/services/api/thunks/schema.ts b/invokeai/frontend/web/src/services/api/thunks/schema.ts index c209469e02..ed36ac4cfb 100644 --- a/invokeai/frontend/web/src/services/api/thunks/schema.ts +++ b/invokeai/frontend/web/src/services/api/thunks/schema.ts @@ -26,8 +26,9 @@ export const receivedOpenAPISchema = createAsyncThunk( 'nodes/receivedOpenAPISchema', async (_, { rejectWithValue }) => { try { - const url = [window.location.origin, 'openapi.json'].join('/'); - const response = await fetch(url); + const response = await fetch( + `${window.location.href.replace(/\/$/, '')}/openapi.json` + ); const openAPISchema = await response.json(); const schemaJSON = JSON.parse(