From fb218b11a30321e0b3aa66808bd0a3cfd6c34236 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 08:44:50 -0600 Subject: [PATCH 1/9] variable for site name --- .github/workflows/auto-tag.yml | 2 +- .github/workflows/pr-e2e.yml | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml index 2f01367474..d898aa7bd1 100644 --- a/.github/workflows/auto-tag.yml +++ b/.github/workflows/auto-tag.yml @@ -30,4 +30,4 @@ jobs: with: expected_sha: ${{ github.sha }} target_env: live - pantheon_site_machine_name: documentation-in-nextjs + pantheon_site_machine_name: ${{ vars.PANTHEON_SITE_MACHINE_NAME }} diff --git a/.github/workflows/pr-e2e.yml b/.github/workflows/pr-e2e.yml index 3bc31ed08f..c09d107ec1 100644 --- a/.github/workflows/pr-e2e.yml +++ b/.github/workflows/pr-e2e.yml @@ -22,14 +22,14 @@ jobs: with: expected_sha: ${{ github.event.pull_request.head.sha }} target_env: pr-${{ github.event.pull_request.number }} - pantheon_site_machine_name: documentation-in-nextjs + pantheon_site_machine_name: ${{ vars.PANTHEON_SITE_MACHINE_NAME }} - name: warm containers id: warm_containers shell: bash env: - REFERENCE_BASE_URL: "https://dev-documentation-in-nextjs.pantheonsite.io" - DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-documentation-in-nextjs.pantheonsite.io" + REFERENCE_BASE_URL: "https://dev-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io" + DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io" run: | #!/bin/bash set +e @@ -54,7 +54,7 @@ jobs: - name: Check all status codes env: PR_NUMBER: ${{ github.event.pull_request.number }} - SITE_NAME: "documentation-in-nextjs" + SITE_NAME: "${{ vars.PANTHEON_SITE_MACHINE_NAME }}" run: | cd tests/404checking export URL="https://pr-${PR_NUMBER}-${SITE_NAME}.pantheonsite.io" @@ -86,8 +86,8 @@ jobs: id: backstop_tests shell: bash env: - REFERENCE_BASE_URL: "https://dev-documentation-in-nextjs.pantheonsite.io" - DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-documentation-in-nextjs.pantheonsite.io" + REFERENCE_BASE_URL: "https://dev-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io" + DEPLOYED_BASE_URL: "https://pr-${{ github.event.pull_request.number }}-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io" run: | #!/bin/bash set +e @@ -125,7 +125,7 @@ jobs: id: playwright_tests shell: bash env: - PLAYWRIGHT_DOMAIN: "pr-${{ github.event.pull_request.number }}-documentation-in-nextjs.pantheonsite.io" + PLAYWRIGHT_DOMAIN: "pr-${{ github.event.pull_request.number }}-${{ vars.PANTHEON_SITE_MACHINE_NAME }}.pantheonsite.io" run: | #!/bin/bash set +e From 81919661a7794745ed663720369045f6265c30a1 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 09:07:46 -0600 Subject: [PATCH 2/9] fixing flaky test --- tests/playwright/tests/search/search.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/tests/search/search.spec.ts b/tests/playwright/tests/search/search.spec.ts index 9fcdaad11f..5db3df5f50 100644 --- a/tests/playwright/tests/search/search.spec.ts +++ b/tests/playwright/tests/search/search.spec.ts @@ -43,7 +43,7 @@ test('searching from homepage redirects to search page and shows expected result await page.waitForSelector('#results .addsearch-searchresults'); - const expectedPolicyHeadline = ' Overages Policy | Traffic | Pantheon Docs'; + const expectedPolicyHeadline = ' Overages Policy | Pantheon Docs'; const h3s1 = await page.locator('h3').allTextContents(); expect(h3s1.some(text => text.includes(expectedPolicyHeadline))).toBeTruthy(); }); From da8bfc44a2be76b0e2965ec11a98a28602433de4 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 10:04:29 -0600 Subject: [PATCH 3/9] adding variable for site machine name --- src/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index e0622be0b9..1b9689ddbe 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -226,7 +226,7 @@ export function middleware(request: NextRequest) { // This section handles the HTTP to HTTPS redirects for Pantheon sites. // See https://github.com/pantheon-systems/documentation/issues/9791 // for more context. - const siteMachineName = "documentation-in-nextjs"; + const siteMachineName = process.env.PANTHEON_SITE_MACHINE_NAME || "documentation-in-nextjs"; const incomingProtocol = request.headers.get('x-proto') || ''; const policyDocSurrogateKey = request.headers.get('policy-doc-surrogate-key') || ''; if (incomingProtocol === 'http://' && policyDocSurrogateKey) { From 44ef66a51b0da08bdbcf5fc9fb9c8809df846fe9 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 11:22:48 -0600 Subject: [PATCH 4/9] Update pr-e2e.yml --- .github/workflows/pr-e2e.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-e2e.yml b/.github/workflows/pr-e2e.yml index c09d107ec1..f0fafaf31b 100644 --- a/.github/workflows/pr-e2e.yml +++ b/.github/workflows/pr-e2e.yml @@ -140,6 +140,7 @@ jobs: vitest: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From abf972f21ff7d3f821e862be0dcb9782c245741f Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 11:43:03 -0600 Subject: [PATCH 5/9] adding logging --- src/middleware.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/middleware.ts b/src/middleware.ts index 1b9689ddbe..cc2ead8310 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -227,6 +227,9 @@ export function middleware(request: NextRequest) { // See https://github.com/pantheon-systems/documentation/issues/9791 // for more context. const siteMachineName = process.env.PANTHEON_SITE_MACHINE_NAME || "documentation-in-nextjs"; + +console.log('the siteMachineName is:' + siteMachineName) + const incomingProtocol = request.headers.get('x-proto') || ''; const policyDocSurrogateKey = request.headers.get('policy-doc-surrogate-key') || ''; if (incomingProtocol === 'http://' && policyDocSurrogateKey) { From 89b427a3f6c13bb70d7635196ed6693844d58719 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 12:19:05 -0600 Subject: [PATCH 6/9] more debugging --- src/middleware.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index cc2ead8310..5d94595666 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -228,10 +228,15 @@ export function middleware(request: NextRequest) { // for more context. const siteMachineName = process.env.PANTHEON_SITE_MACHINE_NAME || "documentation-in-nextjs"; -console.log('the siteMachineName is:' + siteMachineName) +console.log('the siteMachineName is: ' + siteMachineName) const incomingProtocol = request.headers.get('x-proto') || ''; const policyDocSurrogateKey = request.headers.get('policy-doc-surrogate-key') || ''; + +console.log('the incoming protocol is: ' + incomingProtocol) +console.log('the policy doc surrogate key is: ' + policyDocSurrogateKey); + + if (incomingProtocol === 'http://' && policyDocSurrogateKey) { if (policyDocSurrogateKey.trim().endsWith(siteMachineName + '.pantheonsite.io')) { url.protocol = "https:"; From 2e7093963a98c8180b0a39d456897fcdd462b430 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 12:54:41 -0600 Subject: [PATCH 7/9] whitespace to retrigger build --- src/middleware.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/middleware.ts b/src/middleware.ts index 5d94595666..a482ec75ca 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -236,7 +236,6 @@ console.log('the siteMachineName is: ' + siteMachineName) console.log('the incoming protocol is: ' + incomingProtocol) console.log('the policy doc surrogate key is: ' + policyDocSurrogateKey); - if (incomingProtocol === 'http://' && policyDocSurrogateKey) { if (policyDocSurrogateKey.trim().endsWith(siteMachineName + '.pantheonsite.io')) { url.protocol = "https:"; From 2e6b46c2c1fbff9adace3f9c61a8bc9ea1f7b498 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 13:14:20 -0600 Subject: [PATCH 8/9] removing extra debugging --- src/middleware.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/middleware.ts b/src/middleware.ts index a482ec75ca..1b9689ddbe 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -227,15 +227,8 @@ export function middleware(request: NextRequest) { // See https://github.com/pantheon-systems/documentation/issues/9791 // for more context. const siteMachineName = process.env.PANTHEON_SITE_MACHINE_NAME || "documentation-in-nextjs"; - -console.log('the siteMachineName is: ' + siteMachineName) - const incomingProtocol = request.headers.get('x-proto') || ''; const policyDocSurrogateKey = request.headers.get('policy-doc-surrogate-key') || ''; - -console.log('the incoming protocol is: ' + incomingProtocol) -console.log('the policy doc surrogate key is: ' + policyDocSurrogateKey); - if (incomingProtocol === 'http://' && policyDocSurrogateKey) { if (policyDocSurrogateKey.trim().endsWith(siteMachineName + '.pantheonsite.io')) { url.protocol = "https:"; From ba5271b9e5e2e37c0e8bbad6ac927103fea08974 Mon Sep 17 00:00:00 2001 From: Steve Persch Date: Wed, 31 Dec 2025 13:38:27 -0600 Subject: [PATCH 9/9] Update pr-e2e.yml --- .github/workflows/pr-e2e.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr-e2e.yml b/.github/workflows/pr-e2e.yml index f0fafaf31b..c09d107ec1 100644 --- a/.github/workflows/pr-e2e.yml +++ b/.github/workflows/pr-e2e.yml @@ -140,7 +140,6 @@ jobs: vitest: runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4