Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/docker-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1518,8 +1518,11 @@ describe('docker-manager', () => {
const result = generateDockerCompose(configWithProxy, mockNetworkConfigWithProxy);
const agent = result.services.agent;
const env = agent.environment as Record<string, string>;
expect(env.NO_PROXY).toContain('127.0.0.1');
expect(env.NO_PROXY).toContain('localhost');
expect(env.NO_PROXY).toContain('api-proxy');
expect(env.NO_PROXY).toContain('172.30.0.30');
expect(env.NO_PROXY).toContain('172.30.0.0/16');
expect(env.no_proxy).toBe(env.NO_PROXY);
});

Expand All @@ -1529,10 +1532,12 @@ describe('docker-manager', () => {
const agent = result.services.agent;
const env = agent.environment as Record<string, string>;
// Should contain both the host access NO_PROXY entries and api-proxy
expect(env.NO_PROXY).toContain('127.0.0.1');
expect(env.NO_PROXY).toContain('localhost');
expect(env.NO_PROXY).toContain('host.docker.internal');
expect(env.NO_PROXY).toContain('api-proxy');
expect(env.NO_PROXY).toContain('172.30.0.30');
expect(env.NO_PROXY).toContain('172.30.0.0/16');
expect(env.no_proxy).toBe(env.NO_PROXY);
});

Expand Down
3 changes: 2 additions & 1 deletion src/docker-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,8 @@ export function generateDockerCompose(

// Add api-proxy to NO_PROXY so agent traffic goes directly to the sidecar
// instead of routing through Squid (which would block the "api-proxy" hostname)
const proxyNoProxy = `api-proxy,${networkConfig.proxyIp}`;
// Include localhost, the specific IP, and the network CIDR to ensure all tools can bypass Squid
const proxyNoProxy = `127.0.0.1,localhost,${networkConfig.proxyIp},172.30.0.0/16,api-proxy`;
if (environment.NO_PROXY) {
environment.NO_PROXY += `,${proxyNoProxy}`;
environment.no_proxy = environment.NO_PROXY;
Expand Down
Loading