Skip to content
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

Revalidate whole path for 404 and 307 paths, new pages and changed redirects #252

Closed
wants to merge 2 commits into from

Conversation

pookmish
Copy link
Contributor

@pookmish pookmish commented Dec 16, 2024

READY FOR REVIEW

Summary

  • This should help with 404 pages and 307 pages.
  • When a path produces a 404 or 307 response, it gets heavily cached. Cache tags have no impact to trigger that path to regenerate. This change will fetch the path in question and clear out the path if it's a 404 or 307 response, allowing the page to re rebuilt.

Setup tasks and/or behavior to test

  1. Check out this branch
  2. Set environment variable in your .env.local NEXT_PUBLIC_DOMAIN=http://localhost:3000
  3. run rm -rf .next; yarn preview and allow it to build
  4. go to a page that will be a 404, like http://localhost:3000/foo/bar
  5. verify the 404 is returned
  6. in the drupal side on your local, create a node and manually configure the path alias to be /foo/bar & Save
  7. reload your localhost page.
  8. verify it loads the created page
  9. delete the page in Drupal
  10. reload localhost to verify it's 404 again
  11. create a redirect from /foo/bar to some other page
  12. reload localhost to verify it redirects
  13. change the redirect in drupal to another page
  14. load localhost:3000/foo/bar again
  15. verify it redirect to the new location.

Copy link

vercel bot commented Dec 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
su-library ✅ Ready (Inspect) Visit Preview Jan 7, 2025 8:00pm

@imonroe
Copy link
Contributor

imonroe commented Jan 7, 2025

Trying this locally, and I successfully get to step 7 in the testing instructions. In step 8, it still gives me a 404. When I look at /preview/foo/bar, the page appears correctly, but the original path doesn't. Am I doing something wrong? Edit: I tried the same thing on the vercel preview site, with the same result. The 404 is still getting served, even though the page has been created and published.

@pookmish
Copy link
Contributor Author

pookmish commented Jan 7, 2025

@imonroe, I actually think we can hold on this. it looks like there might be some work happening in the next.js that might resolve this issue.

@pookmish
Copy link
Contributor Author

pookmish commented Jan 7, 2025

Yep. I confirmed that in the Canary version of Next, it fixes the cache tag invalidation issue this PR was attempting to solve.
ref: vercel/next.js#74577

@pookmish pookmish closed this Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants