@tramvai/module-http-proxy-agent 7.21.1 → 7.26.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/server.es.js CHANGED
@@ -34,12 +34,27 @@ HttpProxyAgentModule = __decorate([
34
34
  });
35
35
  metricsConnectionCounter.inc({ host: new URL(connectParams.origin).host });
36
36
  });
37
+ // undici DNS interceptor is incompatible with EnvHttpProxyAgent —
38
+ // compose() runs interceptors before proxy routing, so DNS resolution
39
+ // replaces hostnames with IPs before NO_PROXY check, breaking hostname-based matching.
40
+ // Filter it out; DNS caching for http.Agent still works via cacheable-lookup.
41
+ const compatibleInterceptors = (interceptors ?? []).filter((interceptor) => {
42
+ if (interceptor.__tramvai_dns_interceptor) {
43
+ logger.warn({
44
+ event: 'dns-interceptor-skipped',
45
+ message: 'Undici DNS interceptor is incompatible with EnvHttpProxyAgent and was excluded. ' +
46
+ 'DNS caching for http.Agent requests still works via cacheable-lookup.',
47
+ });
48
+ return false;
49
+ }
50
+ return true;
51
+ });
37
52
  const agent = new EnvHttpProxyAgent({
38
53
  httpProxy: proxyEnv,
39
54
  httpsProxy: proxyEnv,
40
55
  noProxy: noProxyEnv,
41
56
  ...options,
42
- }).compose(...(interceptors ?? []));
57
+ }).compose(...compatibleInterceptors);
43
58
  return {
44
59
  http: agent,
45
60
  https: agent,
package/lib/server.js CHANGED
@@ -42,12 +42,27 @@ exports.HttpProxyAgentModule = tslib.__decorate([
42
42
  });
43
43
  metricsConnectionCounter.inc({ host: new URL(connectParams.origin).host });
44
44
  });
45
+ // undici DNS interceptor is incompatible with EnvHttpProxyAgent —
46
+ // compose() runs interceptors before proxy routing, so DNS resolution
47
+ // replaces hostnames with IPs before NO_PROXY check, breaking hostname-based matching.
48
+ // Filter it out; DNS caching for http.Agent still works via cacheable-lookup.
49
+ const compatibleInterceptors = (interceptors ?? []).filter((interceptor) => {
50
+ if (interceptor.__tramvai_dns_interceptor) {
51
+ logger.warn({
52
+ event: 'dns-interceptor-skipped',
53
+ message: 'Undici DNS interceptor is incompatible with EnvHttpProxyAgent and was excluded. ' +
54
+ 'DNS caching for http.Agent requests still works via cacheable-lookup.',
55
+ });
56
+ return false;
57
+ }
58
+ return true;
59
+ });
45
60
  const agent = new undici.EnvHttpProxyAgent({
46
61
  httpProxy: proxyEnv,
47
62
  httpsProxy: proxyEnv,
48
63
  noProxy: noProxyEnv,
49
64
  ...options,
50
- }).compose(...(interceptors ?? []));
65
+ }).compose(...compatibleInterceptors);
51
66
  return {
52
67
  http: agent,
53
68
  https: agent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/module-http-proxy-agent",
3
- "version": "7.21.1",
3
+ "version": "7.26.8",
4
4
  "description": "Enable support for http_proxy, https_proxy and no_proxy env variables",
5
5
  "browser": "lib/browser.js",
6
6
  "main": "lib/server.js",
@@ -26,13 +26,13 @@
26
26
  "undici": "^7.24.4"
27
27
  },
28
28
  "dependencies": {
29
- "@tramvai/tokens-common": "7.21.1",
30
- "@tramvai/tokens-http-client": "7.21.1",
31
- "@tramvai/tokens-metrics": "7.21.1"
29
+ "@tramvai/tokens-common": "7.26.8",
30
+ "@tramvai/tokens-http-client": "7.26.8",
31
+ "@tramvai/tokens-metrics": "7.26.8"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@tinkoff/dippy": "^1.0.0",
35
- "@tramvai/core": "7.21.1",
35
+ "@tramvai/core": "7.26.8",
36
36
  "tslib": "^2.4.0",
37
37
  "undici": "*"
38
38
  }