cli icon indicating copy to clipboard operation
cli copied to clipboard

fix: support for redirects with 200 status. Fix crashing dev server w…

Open VitaliyR opened this issue 8 months ago • 1 comments

…hen have socket error. Follow redirects from proxyRes

🎉 Thanks for submitting a pull request! 🎉

Summary

Fixes WRFL-2263

One of the customers who are using Gatsby uses a 200 redirect

[[redirects]]
from = "/de-DE/*"
to = "/:splat"
status = 200

It works on prod but doesn't in netlify dev

Root cause for that we are not overriding the url if the file is not static, and in case of dev server running on gatsby (or next as well) - it is never static.

See the updated redirects.test.ts -> specifically the site-with-redirect > should do local redirect It creates a simple redirect for /local/* to /:splat with status 200, user navigates for /local/test/exists:

before the change: 404 page not found after the change: keeping url of /local/test/exists but content of /test/exists (as per docs)


For us to review and ship your PR efficiently, please perform the following steps:

  • [ ] Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • [ ] Read the contribution guidelines 📖. This ensures your code follows our style guide and passes our tests.
  • [ ] Update or add tests (if any source code was changed or added) 🧪
  • [ ] Update or add documentation (if features were changed or added) 📝
  • [ ] Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

VitaliyR avatar Feb 12 '25 20:02 VitaliyR