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

fix: exclude Vite requests from trailing slash handling #13095

Merged
merged 4 commits into from
Jan 30, 2025
Merged

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jan 30, 2025

Changes

Skips internal Vite requests when checking trailing slashes

Fixes #13094

Testing

Adding tests now

Docs

Copy link

changeset-bot bot commented Jan 30, 2025

🦋 Changeset detected

Latest 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

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Jan 30, 2025
Copy link

codspeed-hq bot commented Jan 30, 2025

CodSpeed Performance Report

Merging #13095 will not alter performance

Comparing no-slash-vite (da04d5a) with main (740eb60)

Summary

✅ 6 untouched benchmarks

Copy link
Member

@ematipico ematipico left a 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('/@')) {
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭

@ascorbic ascorbic merged commit 740eb60 into main Jan 30, 2025
5 checks passed
@ascorbic ascorbic deleted the no-slash-vite branch January 30, 2025 16:04
@astrobot-houston astrobot-houston mentioned this pull request Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirect to 404 when fetching src files on dev server
3 participants