Support NODE_TLS_REJECT_UNAUTHORIZED=0 to ignore client errors #341

Apparently `NODE_TLS_REJECT_UNAUTHORIZED` is only effective if
`rejectUnauthorized` was not overridden by the code:
85e6089c4d/lib/_tls_wrap.js (L1583-L1591)

But the underlying library does override it:
https://github.com/http-party/node-http-proxy/blob/v1.11.1/lib/http-proxy/common.js#L53-L55

Fix this by overriding the option via the library's "secure" option.
This commit is contained in:
Rob Wu
2021-03-21 23:38:32 +01:00
parent d10efb1b46
commit 3c87a51664
2 changed files with 77 additions and 0 deletions

View File

@@ -407,6 +407,7 @@ exports.createServer = function createServer(options) {
// Default options:
var httpProxyOptions = {
xfwd: true, // Append X-Forwarded-* headers
secure: process.env.NODE_TLS_REJECT_UNAUTHORIZED !== '0',
};
// Allow user to override defaults and add own options
if (options.httpProxyOptions) {