Fix for issues with binding ports other than 80/443

server/routers/badger/verifySession.ts : verifyResourceSession() updated code behind "cleanHost" var to a regex which strips the trailing :port for any port (rather than a string match for 80/443)
src/app/auth/resource/[resourceId]/page.tsx : ResourceAuthPage() added a secondary match for serverResourceHost and redirectHost that accounts for ports
server/routers/badger/exchangeSession.ts : Updated exchangeSession() to use the same "cleanHost" type var (with port-stripping) as in verifyResourceSession(), replaced references to "host" with "cleanHost"
This commit is contained in:
T Aviss
2025-07-30 22:16:46 -07:00
parent 69b28b9b02
commit 481714f095
3 changed files with 17 additions and 7 deletions

View File

@@ -121,11 +121,10 @@ export async function verifyResourceSession(
logger.debug("Client IP:", { clientIp });
let cleanHost = host;
// if the host ends with :443 or :80 remove it
if (cleanHost.endsWith(":443")) {
cleanHost = cleanHost.slice(0, -4);
} else if (cleanHost.endsWith(":80")) {
cleanHost = cleanHost.slice(0, -3);
// if the host ends with :port, strip it
if (cleanHost.match(/:[0-9]{1,5}$/)) {
let matched = ''+cleanHost.match(/:[0-9]{1,5}$/);
cleanHost = cleanHost.slice(0, -1*matched.length);
}
const resourceCacheKey = `resource:${cleanHost}`;