finally add http/s_proxy support for oidc and more in future #6616

Signed-off-by: si458 <simonsmith5521@gmail.com>

si458 committed Oct 28, 2025 at 16:42 UTC 1bd06ccded89bd48e2264d18117066bcd8f35bbe
1 file changed +9
webserver.js
+9
@@ -58,6 +58,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
58 // Setup WebAuthn / FIDO2
59 obj.webauthn = require('./webauthn.js').CreateWebAuthnModule();
60
61 + if (process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']) {
62 + obj.httpsProxyAgent = new (require('https-proxy-agent').HttpsProxyAgent)(process.env['HTTP_PROXY'] || process.env['HTTPS_PROXY'] || process.env['http_proxy'] || process.env['https_proxy']);
63 + }
64 +
65 // Variables
66 obj.args = args;
67 obj.parent = parent;
@@ -7979,6 +7983,10 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
7983 }
7984 strategy.options.params.scope = strategy.options.params.scope.join(' ')
7985
7986 + if (obj.httpsProxyAgent) {
7987 + // process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; // add using environment variables if needs be not here
7988 + strategy.obj.openidClient.custom.setHttpOptionsDefaults({ agent: obj.httpsProxyAgent });
7989 + }
7990 // Discover additional information if available, use endpoints from config if present
7991 let issuer
7992 try {
@@ -8182,6 +8190,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates, doneF
8190 const options = {
8191 'headers': { authorization: 'Bearer ' + tokenset.access_token }
8192 }
8193 + if (obj.httpsProxyAgent) { options.agent = obj.httpsProxyAgent; }
8194 const req = require('https').get(url, options, (res) => {
8195 let data = []
8196 res.on('data', (chunk) => {