fix(cloud): route the hosted assistant through its private gateway

This commit is contained in:
Maurice
2026-12-01 19:28:28 +01:00
parent 4ad926aafc
commit 89035059ec
2 changed files with 42 additions and 3 deletions
@@ -1,4 +1,4 @@
import { safeFetch, safeFetchLlm } from '../../utils/ssrfGuard';
import { safeFetch, safeFetchAdminConfigured, safeFetchLlm } from '../../utils/ssrfGuard';
import type { AiChatClient } from './ai-chat-client.interface';
import { AI_BASE_URLS, ownServerChatBase } from './ai-connections.constants';
import type { ResolvedAiConnection } from './ai-connections.types';
@@ -16,7 +16,9 @@ import { Injectable } from '@nestjs/common';
* is the adapter's.
*/
const cloudFetch: AiFetch = (url, init) => safeFetch(url, { ...init, signal: init.signal }, { maxBytes: null });
const hostedFetch: AiFetch = (url, init) => cloudFetch(url, { ...init, redirect: 'error' });
/** The operator's HTTPS gateway can resolve to its private proxy inside the tenant network. */
const hostedFetch: AiFetch = (url, init) => safeFetchAdminConfigured(url, init, 0, undefined, null);
/**
* An admin's own server, which may sit on loopback or in the LAN: the guard