You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[v6] trailing slash never for endpoints with file extension (#12467)
Co-authored-by: Matt Kane <m@mk.gg>
Co-authored-by: Junseong Park <to@jspark.dev>
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Note that endpoints whose URLs include a file extension (e.g. `src/pages/sitemap.xml.ts`) can only be accessed without a trailing slash (e.g. `/sitemap.xml`), regardless of your [`build.trailingSlash`](/en/reference/configuration-reference/#trailingslash) configuration.
51
+
50
52
### `params` and Dynamic routing
51
53
52
54
Endpoints support the same [dynamic routing](/en/guides/routing/#dynamic-routes) features that pages do. Name your file with a bracketed parameter name and export a [`getStaticPaths()` function](/en/reference/routing-reference/#getstaticpaths). Then, you can access the parameter using the `params` property passed to the endpoint function:
In Astro v5.0, the `i18n.routing.redirectToDefaultLocale` default value was `true`. When combined with the `i18n.routing.prefixDefaultLocale` default value of `false`, the resulting redirects could cause infinite loops.
381
385
382
386
In Astro v6.0, `i18n.routing.redirectToDefaultLocale` now defaults to `false`. Additionally, it can now only be used if `i18n.routing.prefixDefaultLocale` is set to `true`.
The following changes are considered breaking changes in Astro v5.0. Breaking changes may or may not provide temporary backwards compatibility. If you were using these features, you may have to update your code as recommended in each entry.
406
410
411
+
### Changed: endpoints with a file extension cannot be accessed with a trailing slash
412
+
413
+
<SourcePRnumber="14457"title="feat!: trailing slash never for endpoints with file extension"/>
414
+
415
+
In Astro v5.0, custom endpoints whose URL ended in a file extension (e.g. `/src/pages/sitemap.xml.ts` ) could be accessed with a trailing slash (`/sitemap.xml/`) or without (`/sitemap.xml`), regardless of the value configured for `build.trailingSlash`.
416
+
417
+
In Astro v6.0, these endpoints can only be accessed without a trailing slash. This is true regardless of your `build.trailingSlash` configuration.
418
+
419
+
#### What should I do?
420
+
421
+
Review your links to your custom endpoints that include a file extension in the URL and remove any trailing slashes:
<ReadMore>Learn more about [custom endpoints](/en/guides/endpoints/).</ReadMore>
429
+
407
430
## Community Resources
408
431
409
432
Know a good resource for Astro v5.0? [Edit this page](https://github.com/withastro/docs/edit/main/src/content/docs/en/guides/upgrade-to/v6.mdx) and add a link below!
0 commit comments