From 88cc214ddbafa9cc5623c76975969b6dfc52964c Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 26 Jun 2026 11:21:24 +0200 Subject: [PATCH] fix(ci): use correct auth cookie name for e-tib gatekeeper bypass --- scripts/lhci-puppeteer-setup.cjs | 7 ++++--- scripts/pagespeed-sitemap.ts | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scripts/lhci-puppeteer-setup.cjs b/scripts/lhci-puppeteer-setup.cjs index 2dc37a5a2..dc9917c28 100644 --- a/scripts/lhci-puppeteer-setup.cjs +++ b/scripts/lhci-puppeteer-setup.cjs @@ -6,13 +6,14 @@ module.exports = async (browser, context) => { const page = await browser.newPage(); // Using LHCI_URL or TARGET_URL if available const targetUrl = - process.env.LHCI_URL || process.env.TARGET_URL || 'https://testing.klz-cables.com'; + process.env.LHCI_URL || process.env.TARGET_URL || 'https://testing.e-tib.com'; const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026'; + const authCookieName = process.env.AUTH_COOKIE_NAME || 'etib_gatekeeper_session'; - console.log(`šŸ”‘ LHCI Auth: Setting gatekeeper cookie for ${new URL(targetUrl).hostname}...`); + console.log(`šŸ”‘ LHCI Auth: Setting gatekeeper cookie (${authCookieName}) for ${new URL(targetUrl).hostname}...`); await page.setCookie({ - name: 'klz_gatekeeper_session', + name: authCookieName, value: gatekeeperPassword, domain: new URL(targetUrl).hostname, path: '/', diff --git a/scripts/pagespeed-sitemap.ts b/scripts/pagespeed-sitemap.ts index dc4805bbf..a81709985 100644 --- a/scripts/pagespeed-sitemap.ts +++ b/scripts/pagespeed-sitemap.ts @@ -19,6 +19,7 @@ const targetUrl = 'http://localhost:3000'; const limit = process.env.PAGESPEED_LIMIT ? parseInt(process.env.PAGESPEED_LIMIT) : 20; // Default limit to avoid infinite runs const gatekeeperPassword = process.env.GATEKEEPER_PASSWORD || 'klz2026'; +const authCookieName = process.env.AUTH_COOKIE_NAME || 'etib_gatekeeper_session'; async function main() { console.log(`\nšŸš€ Starting PageSpeed test for: ${targetUrl}`); @@ -32,7 +33,7 @@ async function main() { // We might need to bypass gatekeeper for the sitemap fetch too const response = await axios.get(sitemapUrl, { headers: { - Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`, + Cookie: `${authCookieName}=${gatekeeperPassword}`, }, validateStatus: (status) => status < 400, }); @@ -77,7 +78,7 @@ async function main() { // Handle authentication for staging/testing // Lighthouse can set cookies via --collect.settings.extraHeaders const extraHeaders = JSON.stringify({ - Cookie: `klz_gatekeeper_session=${gatekeeperPassword}`, + Cookie: `${authCookieName}=${gatekeeperPassword}`, }); // Detect Chrome path from Puppeteer installation if not provided