ignore self signed certs
Build and Push Docker Images / build-and-push (push) Successful in 29s

This commit is contained in:
Bram committed 2026-11-04 12:17:49 +01:00
1 parent 454f1c9d6d
commit 8855d36684
7 files changed
+24 -6

No files matched your search

@@ -15,7 +15,7 @@ services:
# playlist-URLs. Leeg laten om de Host-header van het request te gebruiken. # playlist-URLs. Leeg laten om de Host-header van het request te gebruiken.
# PUBLIC_URL: "http://192.168.0.123:8080" # PUBLIC_URL: "http://192.168.0.123:8080"
# LOG_REQUESTS: "1" # log elke (stream)request en status # LOG_REQUESTS: "1" # log elke (stream)request en status
# PROXY_INSECURE_TLS: "1" # alleen nodig bij self-signed upstream-certificaten # PROXY_INSECURE_TLS: "1" # globale TLS-verificatie uitzetten; per entry kan ook "insecureTls": true
volumes: volumes:
- ./upstreams.json:/config/upstreams.json:ro - ./upstreams.json:/config/upstreams.json:ro
restart: unless-stopped restart: unless-stopped
+10 -1
View File
@@ -44,6 +44,15 @@ function readConfigEntries() {
return; return;
} }
let insecureTls = false;
if (item.insecureTls !== undefined) {
if (typeof item.insecureTls !== 'boolean') {
console.warn(`${label}: "insecureTls" must be a boolean, ignoring`);
} else {
insecureTls = item.insecureTls;
}
}
const validUrls = []; const validUrls = [];
const seenUrls = new Set(); const seenUrls = new Set();
urls.forEach((rawUrl, urlIndex) => { urls.forEach((rawUrl, urlIndex) => {
@@ -77,7 +86,7 @@ function readConfigEntries() {
} }
for (const url of validUrls) { for (const url of validUrls) {
entries.push({ url, username, password, entryId: index }); entries.push({ url, username, password, entryId: index, insecureTls });
} }
}); });
return entries; return entries;
+1 -1
View File
@@ -105,7 +105,7 @@ function probeUpstream(upstream) {
'Accept-Encoding': 'identity', 'Accept-Encoding': 'identity',
Connection: 'close', Connection: 'close',
}, },
rejectUnauthorized: settings.rejectUnauthorized, rejectUnauthorized: upstream.rejectUnauthorized,
}, },
(res) => { (res) => {
let body = ''; let body = '';
+1 -1
View File
@@ -303,7 +303,7 @@ function handleProxy(req, res, reqUrl) {
path: `${target.pathname}${target.search}`, path: `${target.pathname}${target.search}`,
method: req.method, method: req.method,
headers, headers,
rejectUnauthorized: settings.rejectUnauthorized, rejectUnauthorized: upstream.rejectUnauthorized,
}, },
(proxyRes) => { (proxyRes) => {
settled = true; settled = true;
@@ -84,6 +84,7 @@ function selectUpstream(exclude = new Set()) {
function describeUpstream(upstream) { function describeUpstream(upstream) {
return { return {
url: upstream.label, url: upstream.label,
insecureTls: upstream.insecureTls,
healthy: upstream.state.healthy, healthy: upstream.state.healthy,
busy: isBusy(upstream), busy: isBusy(upstream),
latencyMs: upstream.state.latencyMs, latencyMs: upstream.state.latencyMs,
+8 -1
View File
@@ -1,5 +1,7 @@
'use strict'; 'use strict';
const { settings } = require('./settings');
function nowIso() { function nowIso() {
return new Date().toISOString(); return new Date().toISOString();
} }
@@ -19,7 +21,7 @@ function baseState() {
} }
class Upstream { class Upstream {
constructor({ url, username, password, entryId }) { constructor({ url, username, password, entryId, insecureTls }) {
const parsed = new URL(url); const parsed = new URL(url);
parsed.hash = ''; parsed.hash = '';
parsed.search = ''; parsed.search = '';
@@ -28,10 +30,15 @@ class Upstream {
this.username = username; this.username = username;
this.password = password; this.password = password;
this.entryId = entryId; this.entryId = entryId;
this.insecureTls = insecureTls === true;
this.key = `${parsed.origin}${this.basePath}|${username}|${password}`; this.key = `${parsed.origin}${this.basePath}|${username}|${password}`;
this.state = { ...baseState(), inFlight: 0 }; this.state = { ...baseState(), inFlight: 0 };
} }
get rejectUnauthorized() {
return this.insecureTls ? false : settings.rejectUnauthorized;
}
get label() { get label() {
return `${this.base.origin}${this.basePath}`; return `${this.base.origin}${this.basePath}`;
} }
+2 -1
View File
@@ -12,6 +12,7 @@
"https://panel2.example.com" "https://panel2.example.com"
], ],
"username": "user2", "username": "user2",
"password": "pass2" "password": "pass2",
"insecureTls": true
} }
] ]