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

Add a way to disable trailing slash logic #2343

Closed
masx200 opened this issue Mar 1, 2024 · 2 comments · May be fixed by #2356
Closed

Add a way to disable trailing slash logic #2343

masx200 opened this issue Mar 1, 2024 · 2 comments · May be fixed by #2356

Comments

@masx200
Copy link

masx200 commented Mar 1, 2024

A global middleware that is not affected by fresh is required.
The handler defined in the routes/_middleware.ts file is not global middleware and will be affected by the trailingSlashEnabled redirect from fresh.

https://deno.land/x/fresh@1.6.5/src/server/context.ts?source#L175

https://deno.land/x/fresh@1.6.5/src/server/context.ts?source#L237

@masx200
Copy link
Author

masx200 commented Mar 1, 2024

#2342

@marvinhagemeister marvinhagemeister changed the title A global middleware that is not affected by fresh is required. The handler defined in the routes/_middleware.ts file is not global middleware and will be affected by the trailingSlashEnabled redirect from fresh. Add a way to disable trailing slash logic Mar 1, 2024
@marvinhagemeister
Copy link
Collaborator

Closing as this is resolved in the upcoming Fresh 2 release. There, by default Fresh will leave the URL as is and devs can opt in to always appending a trailing slash or always removing it via a middleware:

import { App, fsRoutes, staticFiles, trailingSlashes } from "@fresh/core";

export const app = new App()
  .use(staticFiles())
  .use(trailingSlashes("never"));   // <--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants