diff --git a/packages/core/src/core/contentGenerator.test.ts b/packages/core/src/core/contentGenerator.test.ts index 1981f27706..4efd9f65c6 100644 --- a/packages/core/src/core/contentGenerator.test.ts +++ b/packages/core/src/core/contentGenerator.test.ts @@ -851,19 +851,6 @@ describe('createContentGenerator', () => { ), ).rejects.toThrow('Invalid custom base URL: not-a-url'); }); - - it('should reject non-https remote custom baseUrl values', async () => { - await expect( - createContentGenerator( - { - apiKey: 'test-api-key', - authType: AuthType.USE_GEMINI, - baseUrl: 'http://example.com', - }, - mockConfig, - ), - ).rejects.toThrow('Custom base URL must use HTTPS unless it is localhost.'); - }); }); describe('createContentGeneratorConfig', () => { diff --git a/packages/core/src/core/contentGenerator.ts b/packages/core/src/core/contentGenerator.ts index 789942bb51..040fed0e9a 100644 --- a/packages/core/src/core/contentGenerator.ts +++ b/packages/core/src/core/contentGenerator.ts @@ -110,22 +110,16 @@ export interface VertexAiRoutingConfig { sharedRequestType?: VertexAiSharedRequestType; } -const LOCAL_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]']; const VERTEX_AI_REQUEST_TYPE_HEADER = 'X-Vertex-AI-LLM-Request-Type'; const VERTEX_AI_SHARED_REQUEST_TYPE_HEADER = 'X-Vertex-AI-LLM-Shared-Request-Type'; function validateBaseUrl(baseUrl: string): void { - let url: URL; try { - url = new URL(baseUrl); + new URL(baseUrl); } catch { throw new Error(`Invalid custom base URL: ${baseUrl}`); } - - if (url.protocol !== 'https:' && !LOCAL_HOSTNAMES.includes(url.hostname)) { - throw new Error('Custom base URL must use HTTPS unless it is localhost.'); - } } export async function createContentGeneratorConfig(