Repository navigation
Add adapters for redirects middleware #16
Description
Activity
I ran across this while building a SPA with 11ty and in these cases netlify redirects not working is really annoying.
I also created a small reproduction of the issue here: https://github.com/Snapstromegon/netlify-eleventy-dev.
This is a small, but annoying bug (and I don't know if
netlify devnot working too is on this, or netlify-cli's side to fix). There is a workaround for static builds though, when you usenetlify dev:Add these two scripts to your package.json:
{ "build:watch": "npx @11ty/eleventy --watch", "dev": "npx netlify-cli dev" }Add this to your netlify.toml
[dev] framework = "#static" autoLaunch = false command = "npm run build:watch"
This does not work for stuff that requires the use of the dev server like auto reloading, but it solves the base issue as a workaround.
Btw: The redirect parser is now located here: https://github.com/netlify/build/tree/main/packages/redirect-parser
- added a commit that references this issue
on Mar 9, 2023 I also hit this issue, and haven't been able to replicate my
_redirectswithonRequestormiddleware(which is undocumented but read about somewhere) with 11ty 3.0. Note that_redirectsis also supported by Cloudflare Pages, which is what I use: https://developers.cloudflare.com/pages/configuration/redirects/I know that you were referring to middleware but I do want to link up
onRequestdocs: https://www.11ty.dev/docs/dev-server/#on-request-for-request-time-processingMost of the code for this is in @Snapstromegon’s PR here: https://github.com/11ty/eleventy-dev-server/pull/57/files
I would love to have a demo repo for this (or an example on the docs) of how to wire this up with
onRequest, for the record!Reacted by Mario Ortiz Manero- addeddocumentationImprovements or additions to documentationImprovements or additions to documentationand removedenhancementNew feature or requestNew feature or request
on Mar 13, 2025 - marked Request: middleware plugin for netlify redirects #38 as a duplicate of this issue
on Mar 13, 2025 - addedneeds-votesA feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.
on Mar 13, 2025
Personally I’d get a lot of use out of having netlify redirects available in dev mode as an adapter
https://github.com/netlify/netlify-redirect-parser