-
Notifications
You must be signed in to change notification settings - Fork 0
implements audit suggestions #13
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import type { GatsbyNode } from "gatsby"; | ||
|
|
||
| const legacyRedirects = [ | ||
| { | ||
| fromPath: "/2023/10/18/how-to-use-creative-ilks-baby-monitor-on-a-cellular-hotspot-a-step-by-step-guide/", | ||
| toPath: "/blog/how-to/cellular-hotspot/", | ||
| }, | ||
| { | ||
| fromPath: "/2023/10/18/how-to-use-creative-ilks-baby-monitor-on-a-cellular-hotspot-a-step-by-step-guide", | ||
| toPath: "/blog/how-to/cellular-hotspot/", | ||
| }, | ||
| ]; | ||
|
|
||
| export const createPages: GatsbyNode["createPages"] = async ({ actions }) => { | ||
| for (const redirect of legacyRedirects) { | ||
| actions.createRedirect({ | ||
| ...redirect, | ||
| isPermanent: true, | ||
| redirectInBrowser: true, | ||
| }); | ||
| } | ||
|
Comment on lines
+14
to
+21
|
||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switching the CloudFront CustomErrorResponses from serving
/index.htmlto serving/404.htmlmeans unknown paths won’t load the Gatsby app anymore. If you’re relying on GatsbycreateRedirect(or any client-side redirect logic) to handle legacy URLs, those legacy requests will now render the 404 page instead of redirecting unless you add explicit redirect handling at the edge (e.g., inRedirectToIndexIfRequired) or ship static redirect objects/pages for those paths.