Skip to content
2 changes: 2 additions & 0 deletions src/content/docs/en/guides/endpoints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import type { APIRoute } from "astro";
export const GET: APIRoute = async ({ params, request }) => {...}
```

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.

### `params` and Dynamic routing

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:
Expand Down
23 changes: 23 additions & 0 deletions src/content/docs/en/guides/upgrade-to/v6.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ Check that both your development environment and your deployment environment are

### Vite 7.0

<SourcePR number="14445" title="feat: update vite"/>

Astro v6.0 upgrades to Vite v7.0 as the development server and production bundler.

#### What should I do?
Expand Down Expand Up @@ -287,6 +289,8 @@ In most cases, the only action needed is to review your existing project's deplo

### Changed: `i18n.routing.redirectToDefaultLocale` default value

<SourcePR number="14406" title="feat(astro)!: update i18n.redirectToDefaultLocale default"/>

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.

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`.
Expand Down Expand Up @@ -314,6 +318,25 @@ export default defineConfig({

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.

### Changed: endpoints with a file extension cannot be accessed with a trailing slash

<SourcePR number="14457" title="feat!: trailing slash never for endpoints with file extension"/>

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`.

In Astro v6.0, these endpoints can only be accessed without a trailing slash. This is true regardless of your `build.trailingSlash` configuration.

#### What should I do?

Review your links to your custom endpoints that include a file extension in the URL and remove any trailing slashes:

```html del={1} ins={2} title="src/pages/index.astro"
<a href="/sitemap.xml/">Sitemap</a>
<a href="/sitemap.xml">Sitemap</a>
```

<ReadMore>Learn more about [custom endpoints](/en/guides/endpoints/).</ReadMore>

## Community Resources

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!
Expand Down