-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix double-slash redirect paths in CI builds #7343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Hi @kishore08-07 @leecalcote @Rajesh-Nagarajan-11, |
|
🚀 Preview for commit e7c7254 at: https://696cb148b4314a50f9671f57--layer5.netlify.app |
|
🚨 Alert! Git Police! We couldn’t help but notice that one or more of your commits is missing a sign-off. A what? A commit sign-off (your email address). To amend the commits in this PR with your signoff using the instructions provided in the DCO check. To configure your dev environment to automatically signoff on your commits in the future, see these instructions.
|
1 similar comment
|
🚨 Alert! Git Police! We couldn’t help but notice that one or more of your commits is missing a sign-off. A what? A commit sign-off (your email address). To amend the commits in this PR with your signoff using the instructions provided in the DCO check. To configure your dev environment to automatically signoff on your commits in the future, see these instructions.
|
|
@Aman-Cool Thank you for your contribution! Let's discuss this during the website call tomorrow at 6:30 PM IST | 7 AM CST Add it as an agenda item to the meeting minutes, if you would 🙂 |
|
@Aman-Cool sign your commit |
|
🚀 Preview for commit c0159c5 at: https://696e6baa451a44565ba62ac1--layer5.netlify.app |
|
@Aman-Cool attach video before and after |
|
@Aman-Cool Please Read the DCO And Make a signed commit . |
c0159c5 to
6ece969
Compare
Signed-off-by: Raunak Madan <[email protected]>
Signed-off-by: Raunak Madan <[email protected]> Signed-off-by: Aman-Cool <[email protected]>
6ece969 to
6634f86
Compare
|
🚀 Preview for commit 6634f86 at: https://696e8fb51ff71c63a670dcef--layer5.netlify.app |
Fix: Double-Slash Redirect Paths on GitHub Pages Deployments
Summary
This PR fixes a critical redirect bug in
gatsby-node.jsthat generates malformed double-slash (//) paths during GitHub Pages (CI=true) builds. These malformed redirects break trailing-slash navigation across the site and negatively impact SEO.The issue affects all dynamically created pages and only manifests in production GitHub Pages deployments, making it difficult to detect during local development.
Problem Description
When
CI=true, Gatsby creates redirects intended to normalize trailing-slash URLs. However, the current logic incorrectly prepends/to paths that already start with/, producing invalid redirect paths.Example
Given a valid slug:
The current redirect logic generates:
This results in broken redirects for URLs with trailing slashes.
Affected Areas
File:
gatsby-node.jsLines:
onCreatePage)envCreatePage)Deployment Target: GitHub Pages (
CI=true)Pages Impacted:
(1000+ pages total)
Root Cause
All slugs generated in
onCreateNodeare explicitly prefixed with/:Redirect creation logic incorrectly assumes
pathandmatchPathdo not start with/.This mismatch causes double-slash paths (
//) in redirect rules.Reproduction Steps
Production Preview
Open any PR in the
layer5repositoryWait for the GitHub Pages preview build
Open any dynamic page (blog, event, etc.)
Manually add a trailing slash to the URL
Example:
/blog/meshery/my-post/Observe broken or incorrect redirect behavior
Local
Inspect generated redirect HTML files in
public/and note double-slash paths in meta refresh tags.Fix Implemented
Removed the extra leading
/when constructing redirect paths.envCreatePage(lines 65–70)onCreatePage(lines 42–46)Impact After Fix
Why This Matters
This fix prevents widespread broken navigation and SEO degradation across the site’s primary production deployment. It ensures consistent, predictable URL behavior for users, contributors, and search engines alike.
Checklist
Please review and merge to restore correct redirect behavior on GitHub Pages.