Conversation
58b9daa to
ea3929c
Compare
c43dbde to
0f37262
Compare
7f9583f to
60af0d4
Compare
This was referenced Mar 4, 2026
60af0d4 to
80561ee
Compare
matthewp
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
mainis currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, runchangeset pre exitonmain.Releases
astro@6.0.0-beta.18
Major Changes
#15668
1118ac4Thanks @florian-lefebvre! - Changes TypeScript configuration - (v6 upgrade guidance)#15726
6f19eccThanks @ocavue! - Updates dependencyshikito v4Check Shiki's upgrade guide.
Minor Changes
#15694
66449c9Thanks @matthewp! - AddspreserveBuildClientDiroption to adapter featuresAdapters can now opt in to preserving the client/server directory structure for static builds by setting
preserveBuildClientDir: truein their adapter features. When enabled, static builds will output files tobuild.clientinstead of directly tooutDir.This is useful for adapters that require a consistent directory structure regardless of the build output type, such as deploying to platforms with specific file organization requirements.
#15579
08437d5Thanks @ascorbic! - Adds two new experimental flags for a Route Caching API and further configuration-level Route Rules for controlling SSR response caching.Route caching gives you a platform-agnostic way to cache server-rendered responses, based on web standard cache headers. You set caching directives in your routes using
Astro.cache(in.astropages) orcontext.cache(in API routes and middleware), and Astro translates them into the appropriate headers or runtime behavior depending on your adapter. You can also define cache rules for routes declaratively in your config usingexperimental.routeRules, without modifying route code.This feature requires on-demand rendering. Prerendered pages are already static and do not use route caching.
Getting started
Enable the feature by configuring
experimental.cachewith a cache provider in your Astro config:Using
Astro.cacheandcontext.cacheIn
.astropages, useAstro.cache.set()to control caching:In API routes and middleware, use
context.cache:Cache options
cache.set()accepts the following options:maxAge(number): Time in seconds the response is considered fresh.swr(number): Stale-while-revalidate window in seconds. During this window, stale content is served while a fresh response is generated in the background.tags(string[]): Cache tags for targeted invalidation. Tags accumulate across multipleset()calls within a request.lastModified(Date): When multipleset()calls providelastModified, the most recent date wins.etag(string): Entity tag for conditional requests.Call
cache.set(false)to explicitly opt out of caching for a request.Multiple calls to
cache.set()within a single request are merged: scalar values use last-write-wins,lastModifieduses most-recent-wins, and tags accumulate.Invalidation
Purge cached entries by tag or path using
cache.invalidate():Config-level route rules
Use
experimental.routeRulesto set default cache options for routes without modifying route code. Supports Nitro-style shortcuts for ergonomic configuration:Route patterns support static paths, dynamic parameters (
[slug]), and rest parameters ([...path]). Per-routecache.set()calls merge with (and can override) the config-level defaults.You can also read the current cache state via
cache.options:Cache providers
Cache behavior is determined by the configured cache provider. There are two types:
CDN-Cache-Control,Cache-Tag) and let the CDN handle caching. Astro strips these headers before sending the response to the client.onRequest()to intercept and cache responses in-process, adding anX-Astro-Cacheheader (HIT/MISS/STALE) for observability.Built-in memory cache provider
Astro includes a built-in, in-memory LRU runtime cache provider. Import
memoryCachefromastro/configto configure it.Features:
X-Astro-Cacheresponse header:HIT,MISS, orSTALE?b=2&a=1and?a=1&b=2hit the same entry)utm_*,fbclid,gclid, etc.) excluded from cache keys by defaultVaryheader support — responses that setVaryautomatically get separate cache entries per variantquery.exclude(glob patterns) andquery.include(allowlist)For more information on enabling and using this feature in your project, see the Experimental Route Caching docs.
For a complete overview and to give feedback on this experimental API, see the Route Caching RFC.
Patch Changes
#15721
e6e146cThanks @matthewp! - Fixes action route handling to return 404 for requests to prototype method names likeconstructorortoStringused as action paths#15704
862d77bThanks @umutkeltek! - Fixes i18n fallback middleware intercepting non-404 responsesThe fallback middleware was triggering for all responses with status >= 300, including legitimate 3xx redirects, 403 forbidden, and 5xx server errors. This broke auth flows and form submissions on localized server routes. The fallback now correctly only triggers for 404 (page not found) responses.
#15703
829182bThanks @matthewp! - Fixes server islands returning a 500 error in dev mode for adapters that do not setadapterFeatures.buildOutput(e.g.@astrojs/netlify)#15749
573d188Thanks @ascorbic! - Fixes a bug that causedsession.regenerate()to silently lose session dataPreviously, regenerated session data was not saved under the new session ID unless
set()was also called.#15685
1a323e5Thanks @jcayzac! - Fix regression where SVG images in content collectionimage()fields could not be rendered as inline components. This behavior is now restored while preserving the TLA deadlock fix.#15740
c5016fcThanks @matthewp! - Removes an escape hatch that skipped attribute escaping for URL values containing&, ensuring all dynamic attribute values are consistently escaped#15744
fabb710Thanks @matthewp! - Fixes cookie handling during error page rendering to ensure cookies set by middleware are consistently included in the response#15742
9d9699cThanks @matthewp! - HardensclientAddressresolution to respectsecurity.allowedDomainsforX-Forwarded-For, consistent with the existing handling ofX-Forwarded-Host,X-Forwarded-Proto, andX-Forwarded-Port. TheX-Forwarded-Forheader is now only used to determineAstro.clientAddresswhen the request's host has been validated against anallowedDomainsentry. Without a matching domain,clientAddressfalls back to the socket's remote address.#15696
a9fd221Thanks @Princesseuh! - Fixes images not working in MDX when using the Cloudflare adapter in certain cases#15693
4db2089Thanks @ArmandPhilippot! - Fixes the links to Astro Docs to match the v6 structure.#15717
4000aaaThanks @matthewp! - Ensures that URLs with multiple leading slashes (e.g.//admin) are normalized to a single slash before reaching middleware, so that pathname checks likecontext.url.pathname.startsWith('/admin')work consistently regardless of the request URL format#15752
918d394Thanks @ascorbic! - Fixes an issue where a session ID from a cookie with no matching server-side data was accepted as-is. The session now generates a new ID when the cookie value has no corresponding storage entry.#15743
3b4252aThanks @matthewp! - Hardens config-based redirects with catch-all parameters to prevent producing protocol-relative URLs (e.g.//example.com) in theLocationheader#15718
14f37b8Thanks @florian-lefebvre! - Fixes a case where internal headers may leak when rendering error pagesUpdated dependencies [
6f19ecc,f94d3c5]:@astrojs/node@10.0.0-beta.7
Major Changes
#15654
a32aee6Thanks @florian-lefebvre! - Removes theexperimentalErrorPageHostoptionThis option allowed fetching a prerendered error page from a different host than the server is currently running on.
However, there can be security implications with prefetching from other hosts, and often more customization was required to do this safely. This has now been removed as a built-in option so that you can implement your own secure solution as needed and appropriate for your project via middleware.
What should I do?
If you were previously using this feature, you must remove the option from your adapter configuration as it no longer exists:
// astro.config.mjs import { defineConfig } from 'astro/config' import node from '@astrojs/node' export default defineConfig({ adapter: node({ mode: 'standalone', - experimentalErrorPageHost: 'http://localhost:4321' }) })You can replicate the previous behavior by checking the response status in a middleware and fetching the prerendered page yourself:
Patch Changes
#15714
9a2c949Thanks @ematipico! - Fixes an issue where static headers weren't correctly applied when the website usesbase.#15745
20b05c0Thanks @matthewp! - Hardens static file handler path resolution to ensure resolved paths stay within the client directory@astrojs/markdown-remark@7.0.0-beta.9
Major Changes
#15726
6f19eccThanks @ocavue! - Updates dependencyshikito v4Check Shiki's upgrade guide.
Patch Changes
f94d3c5Thanks @ocavue! - Reuses cached Shiki highlighter instances across languages.@astrojs/cloudflare@13.0.0-beta.12
Patch Changes
#15696
a9fd221Thanks @Princesseuh! - Fixes duplicate logging showing up in some cases when prerendering pages#15694
66449c9Thanks @matthewp! - Fixes deployment of static sites with the Cloudflare adapterFixes an issue with detecting and building fully static sites that caused deployment errors when using
output: 'static'with the Cloudflare adapterUpdated dependencies []:
@astrojs/markdoc@1.0.0-beta.13
Patch Changes
6f19ecc,f94d3c5]:@astrojs/mdx@5.0.0-beta.10
Patch Changes
6f19ecc,f94d3c5]: