-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix: exclude Vite requests from trailing slash handling #13095
Conversation
🦋 Changeset detectedLatest commit: da04d5a The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
CodSpeed Performance ReportMerging #13095 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a minor nit; it's good nonetheless!
@@ -22,6 +22,9 @@ export function trailingSlashMiddleware(settings: AstroSettings): vite.Connect.N | |||
/* malformed uri */ | |||
return next(e); | |||
} | |||
if(pathname.startsWith('/_') || pathname.startsWith('/@')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use @vite
to avoid a possible clash with other tools or user-defined endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's also @id
and @fs
and possibly others though. The failure mode is to just not show the helpful error page, so I'd rather err on the side of skipping too many
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😭
Changes
Skips internal Vite requests when checking trailing slashes
Fixes #13094
Testing
Adding tests now
Docs