Skip to content

Commit 89717b1

Browse files
committed
Trust explicitly provided intermediate CA certs for passthrough
Previously these were just ignored. This is not enabled by default, but is clearly the correct behaviour.
1 parent 89229ec commit 89717b1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/rules/passthrough-handling.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as tls from 'tls';
44
import url = require('url');
55
import { oneLine } from 'common-tags';
66
import CacheableLookup from 'cacheable-lookup';
7+
import * as semver from 'semver';
78

89
import { CompletedBody, Headers } from '../types';
910
import { byteLength } from '../util/util';
@@ -92,6 +93,11 @@ export const getUpstreamTlsOptions = (strictChecks: boolean): tls.SecureContextO
9293
requestOSCP: true
9394
} as any),
9495

96+
// Trust intermediate certificates from the trusted CA list too. Without this, trusted CAs
97+
// are only used when they are self-signed root certificates. Seems to cause issues in Node v20
98+
// in HTTP/2 tests, so disabled below the supported v22 version.
99+
allowPartialTrustChain: semver.satisfies(process.version, '>=22.9.0'),
100+
95101
// Allow TLSv1, if !strict:
96102
minVersion: strictChecks ? tls.DEFAULT_MIN_VERSION : 'TLSv1',
97103

0 commit comments

Comments
 (0)