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: Astro greedy routes #3602

Merged
merged 2 commits into from
Jan 10, 2024
Merged

Conversation

bayssmekanique
Copy link
Contributor

This PR resolves #3601, preventing Astro route paths with very greedy RegEx values from capturing requests for static files by testing for a file extension in the CF Function and preventing rewrites if an extension is present.

Example routing before implementation of this PR:
/fr => /fr/index.html
/sitemap-index.xml => /sitemap-index.xml/index.html

Example routing after implementing this PR:
/fr => /fr/index.html
sitema-index.xml => /sitemap-index.xml (unchanged)

The only breaking change I can foresee with this change is if someone were to have implemented a false mime-type endpoint using the static rendering function (/file.png => /file.png/index.html) to serve an HTML page from a URL that appears to point to an asset. I can't see the value in doing this, so I'm assuming it's safe to abandon this functionality to resolve issues with i18n libraries.

Copy link

changeset-bot bot commented Dec 31, 2023

🦋 Changeset detected

Latest commit: 60bc30f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
sst Patch
@sst/console Patch
create-sst Patch
astro-sst Patch
svelte-kit-sst Patch
solid-start-sst Patch

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

@jayair
Copy link
Contributor

jayair commented Jan 6, 2024

Thanks!

@fwang fwang merged commit d45f36c into sst:master Jan 10, 2024
1 check failed
@github-actions github-actions bot mentioned this pull request Jan 10, 2024
@bayssmekanique bayssmekanique deleted the fix/astro-greedy-route branch January 10, 2024 21:05
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 this pull request may close these issues.

Greedy Astro routes break static documents
3 participants