-
Notifications
You must be signed in to change notification settings - Fork 33
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
feat(gatsby-plugin-fastify): Support new trailingSlash
config
#147
Comments
So this went down hill... The First AttemptFirst I thought I'd just add code to the 404 Handler that returned a redirect if the given path did/didn't end in a This generally works. But when stuff shouldn't exist it breaks down. For files...it'll appends slash (e.g. The other issue is sub paths...this doesn't work with client-only routes or SSR splat routes...for those we need to be able to check the actual URL and redirect based on the existence or lack there of of the final This method fails cause it's both overly applied and not applied in specific cases. The Second attemptI began implementing this at a per plugin basis. As conversation on the spec notes...this only applies to "pages"...thus not Functions. I'll assume that applies to Redirects as well.
Problem 1: Static files. Because our static routing is currently handled exclusively by Problem 2: Splat Routes. This issue actually currently exists. Our implementations around splat routes can't handle the situaltion where a route param is followed by a splat. Because of fastify/fastify#3331 we're currently re-writing
Path ForwardOkay I see to primary issues;
Potential solutions
Remaining obstaclesDoes LMW block our custom implementation for splat routes? Context, light my way handles There are 2 kinds of static serving though (hmmmm). css, js, images, etcs (aka. assets) will be served directly...trailingSlash need not apply. But any HTML files will need to be redirected to the correct path. Questions
ConclusionsI though it was going to be hard...then I started and it was getting easier...than it got hard like I didn't think possible. 😢 We'll need to watch performance and hopefully that gets better ...or not worse! |
With the announcement of the Gatsby Adapters spec, we'll be discontinuing any work on this plugin. Should the need for a performant node server still be needed, this work can continue under the official spec as |
Is your feature request related to a problem? Please describe.
Gatsby now has a native config option for trailing slash config...we should support this.
gatsbyjs/gatsby#34268
The text was updated successfully, but these errors were encountered: