Remove my TOML configs & minor bypass key fixes
This commit is contained in:
parent
9bcdc532bb
commit
9372fe8f02
6 changed files with 17 additions and 295 deletions
|
|
@ -651,11 +651,23 @@ function CheckpointMiddleware() {
|
|||
|
||||
// 2) Bypass via header keys
|
||||
for (const { Name, Value, Domains } of checkpointConfig.BypassHeaderKeys) {
|
||||
const headerVal = request.headers.get(Name);
|
||||
// Get header value case-insensitively by checking all headers
|
||||
let headerVal = null;
|
||||
const headersMap = Object.fromEntries([...request.headers.entries()].map(([k, v]) => [k.toLowerCase(), v]));
|
||||
headerVal = headersMap[Name.toLowerCase()] || request.headers.get(Name);
|
||||
|
||||
console.log(`DEBUG - Checking header ${Name}: received="${headerVal}", expected="${Value}", domains=${JSON.stringify(Domains)}`);
|
||||
|
||||
if (headerVal === Value) {
|
||||
console.log(`DEBUG - Header value matched for ${Name}`);
|
||||
if (!Array.isArray(Domains) || Domains.length === 0 || Domains.includes(host)) {
|
||||
console.log(`DEBUG - Domain check passed for ${host}`);
|
||||
return next();
|
||||
} else {
|
||||
console.log(`DEBUG - Domain check failed: ${host} not in ${JSON.stringify(Domains)}`);
|
||||
}
|
||||
} else {
|
||||
console.log(`DEBUG - Header value mismatch for ${Name}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue