Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Fix Notion migrations not working in when served by Netlify. #8960

Merged
merged 2 commits into from
Jun 20, 2024

Conversation

jhchabran
Copy link
Contributor

@jhchabran jhchabran commented Jun 20, 2024

Found why the redirections are not working in prod. In local, NextJS handles the redirections (logical), but in prod, we let Netlify do it (logical, as it's serving static content).

But, the semantics in between the two are not the same:

  • NextJS sets up the redirection "normally"
  • Netlify instead, will flat out ignore the redirection if the page exists.

So the fix was to patch the code that generates the _redirects file that Netlify needs, to add the 301! in /source https://where 301! required for it to stop ignoring those.

I really didn't see coming the different semantics here :/

Copy link

Warning

As we're migrating to Notion, we want to make sure that changes to the handbook are absolutely necessary. To ensure it is the case, it's now mandatory to get an approving review to merge a pull request.

Examples

  • Setting up a redirection to a Notion page: PR will be approved.
  • Correcting an important mistake on a page that doesn't have an equivalent yet: PR will be approved.
  • Updating content that isn't mission critical: PR will be rejected.

Sourcegraphers: Reach out to #wg-notion if you have any question.

Copy link

netlify bot commented Jun 20, 2024

Deploy Preview for sourcegraph-handbook ready!

Name Link
🔨 Latest commit 74a0373
🔍 Latest deploy log https://app.netlify.com/sites/sourcegraph-handbook/deploys/66741756d9030000086d7108
😎 Deploy Preview https://deploy-preview-8960--sourcegraph-handbook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jhchabran jhchabran changed the title Try fixing prod redirection issues Fix Notion migrations not working in when served by Netlify. Jun 20, 2024
@jhchabran jhchabran merged commit 49bc1de into main Jun 20, 2024
11 checks passed
@jhchabran jhchabran deleted the jh/redirect-fix branch June 20, 2024 11:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants