#17846b441180 Thanks @Princesseuh! - Fixes importing .html files not being typed outside of .astro files
#1783132e8b44 Thanks @astro-factory! - Fixes a crash when requesting /index.html against a dynamic page route like [slug].astro
#17841c35448e Thanks @astro-factory! - Fixes SSR manifest containing stale entryModules references to prerender-only chunks that no longer exist in the final build output
#17847eb87a23 Thanks @matthewp! - Fixes set:text escaping in MDX script and style elements
#17772023b48b Thanks @matthewp! - Fixes route selection for normalized request paths in adapter and development request handling
#17819633855b Thanks @matthewp! - Updates generated and default Cloudflare compatibility_date values to match the installed runtime and requires Wrangler ^4.125.0
#17813ae26d18 Thanks @matthewp! - Fixes rewrite() and next(payload) for GET and HEAD requests with host-provided bodies
#17816a0d2fe3 Thanks @astro-factory! - Fixes the experimental svgOptimizer not generating unique per-file ID prefixes when using SVGO’s prefixIds plugin
#17719dac1768 Thanks @astrobot-houston! - Fixes session ID validation to reject non-UUID cookie values before using them as storage keys
#1777084eb7e7 Thanks @astro-factory! - Fixes --mode, --site, --base, --out-dir, --verbose, --silent, and --open flags being silently dropped when using astro dev --background or astro preview --background
#17713d035290 Thanks @wakqasahmed! - Fixes content-modules.mjs not removing entries for deleted or renamed content files, which could cause Vite to attempt to resolve non-existent modules
As part of this fix, #moduleImports is now fully rebuilt from deferredRender entries before every write, so a module import added only through the public addModuleImport() API without a corresponding deferredRender entry in the store will no longer be preserved across writes.
#17743adc750f Thanks @contactjawad! - Fixes Astro.preferredLocale and Astro.preferredLocaleList ignoring Accept-Language quality values when they are absent or 0. An entry without an explicit q= now correctly counts as quality 1.0 (per RFC 7231) and an entry with q=0 is treated as not acceptable, so the highest-quality locale is selected regardless of header order.
#17757660991c Thanks @astro-factory! - Fixes build errors showing wrong file location, missing line:col, and misleading hints when a plugin error (e.g. from MDX) is wrapped by Vite’s build error
#1778360b14ff Thanks @matthewp! - Fixes a type error when passing an image from a content collection image() schema to a component or <Image />. The schema returned by image() was missing the apng format, so it no longer matched the type of an imported image.
#17664d483125 Thanks @astrobot-houston! - Fixes an issue where Astro CSP support didn’t correctly handle cases "unsafe-inline" resource. Now when "unsafe-inline", Astro won’t emit hashes for the directive specified.
#178100fc5f65 Thanks @florian-lefebvre! - Fixes a regression in the content collections that could cause images to not be resolved
#17781aa33b44 Thanks @matthewp! - Fixes memoryCache() storing responses that set cookies through Astro.cookies or Astro.session
#177876661fbe Thanks @astro-factory! - Fixes server:defer crashing the dev server with “undefined is not a function” when a deferred component imports from astro:i18n
#17750dd0e3ac Thanks @dobrodob! - Fixes a regression where transition:persist stopped working for <audio> and <video> elements.
#17774fe1d16d Thanks @astro-factory! - Adds support for importing .apng files as image metadata for use with standard <img> elements. Astro’s image components reject APNG files to avoid removing their animation
#177998797754 Thanks @astro-factory! - Fixes i18n fallbackType: "rewrite" returning 500 instead of 404 when the fallback locale also has no matching static path for a prerendered dynamic route
#177823578d45 Thanks @Princesseuh! - Improves the performance of the Astro CLI in local by enabling Node’s module compilation cache.
#177052043e4f Thanks @astrobot-houston! - Fixes incremental builds serving cached HTML that references stale CSS filenames after a stylesheet-only edit
#177543d50dfd Thanks @astro-factory! - Fixes the dev server refusing to start in Docker containers after a restart due to PID reuse in the lock file check
#17769bbda94d Thanks @astro-factory! - Fixes a build failure when defining vite.environments.ssr in the Astro config. User-provided environment config for ssr, prerender, or client is now properly deep-merged with Astro’s internal environment settings instead of silently breaking the server entry naming.
#177760874da8 Thanks @astro-factory! - Fixes the glob() content loader failing to load files with colons in their names (e.g., Guide: Architecture.md)
#1770105763a0 Thanks @matthewp! - Fixes base path stripping to respect path-segment boundaries. With a configured base such as /docs, a request like /docs-archive/page is no longer treated as being under the base, so routing and context.url.pathname now agree on the same pathname.
#1774270b449d Thanks @Kjubikstronk! - Fixes astro build throwing TypeError: Missing parameter for dynamic routes when build.format: 'preserve' and trailingSlash: 'always' are used together. Stripping the framework-injected .html suffix dropped the trailing slash that the compiled route pattern requires, so the route no longer matched itself and its params resolved as empty.
#17703771b0a9 Thanks @astrobot-houston! - Fixes Astro.site always being undefined when rendering components via the Container API, even when site is set in astroConfig
#1772497140b2 Thanks @ematipico! - Fixes an issue where Astro could run out of memory when experimental.collectionStorage is set to chunked and there are multiple concurrent updates to the same collection.
#1763651723b1 Thanks @matthewp! - Fixes the dev server sometimes matching against stale routes after pages were added, removed, or renamed, requiring a dev server restart to pick up the change
#1763651723b1 Thanks @matthewp! - Fixes the composable request helpers (astro/fetch) throwing an error when used on a request that had been rewritten with Astro.rewrite() or next()
#1763651723b1 Thanks @matthewp! - Refactors Astro’s internal server-side request handling. This is an internal change: all documented public APIs, including App and NodeApp, keep their existing signatures and behavior.
The undocumented internal app.pipeline property and the AppPipeline export from astro/app have been removed. Adapters that used app.pipeline.getLogger() to wait for the configured log destination can call the new app.getLogger() instead.
As a result of this refactor, new FetchState(request) from astro/fetch now works anywhere inside a built Astro server — including custom src/fetch.ts entrypoints — without the request needing to first pass through app.render(). Previously this threw an error, breaking patterns like the Cloudflare adapter’s advanced custom-worker setup.
#17699e28d227 Thanks @ArmandPhilippot! - Fixes several documentation issues related to the JSDoc for configuration options.
When hovering over the server and fonts options, the JSDoc for the nested options was displayed instead of the JSDoc for the top-level property.
Two i18n configuration options were being used incorrectly in the examples.
The indentation of some code blocks was broken on hover.
#175722066f39 Thanks @matthewp! - Fixes a crash when a request arrives with a malformed port in the Host header (for example example.com:65536 or example.com:8080:8080). Such a host made the constructed request URL invalid, and the fallback that was meant to recover reused the same invalid host and threw again. The request URL now degrades to a host the server controls when the incoming host cannot be parsed, so the request is handled instead of erroring.
#176859f15609 Thanks @astrobot-houston! - Fixes a dev server error where an SSR full reload triggered by a third-party Vite plugin (such as @tailwindcss/vite) could fail with Failed to load url astro:server-app.js
#1763651723b1 Thanks @matthewp! - Improves error handling for custom log destinations. When the configured logger fails to load, Astro now reports the error and continues with the default console logger instead of failing the first request.
#17631cf29bec Thanks @matthewp! - Fixes getCollection() and getEntry() throwing DataCloneError when a collection schema transform returns a Temporal.PlainDate or other class instance.
#176119bc3207 Thanks @thelazylamaGit! - Fixes component styles rendered from content entries remaining stale until a second save when an adapter uses Astro’s fallback development environment
#176342267eee Thanks @astrobot-houston! - Fixes incremental builds dropping optimized images for cached pages when using a collectStaticImages prerenderer (e.g. @astrojs/cloudflare with compile-time image optimization)
#176504cdf128 Thanks @astrobot-houston! - Fixes intermittent ImageNotFound errors during build on projects with many images. The build now limits concurrent image file reads to avoid exhausting OS file descriptors (EMFILE) and retries transient I/O errors with backoff. Non-transient errors are no longer silently swallowed.
#176832378221 Thanks @astrobot-houston! - Fixes prerenderConflictBehavior not applying to content collection duplicate ID warnings in the glob() and file() loaders. Setting it to 'error' now throws during content sync, and 'ignore' suppresses the warning.
#1765990c6ea4 Thanks @astrobot-houston! - Fixes the Fonts API breaking experimental.incrementalBuild caching by embedding a build-local, randomly-assigned server port in generated code used for the dependency hash
#17630fd1d9ee Thanks @ericclemmons! - Fixes incremental builds becoming prohibitively slow for sites with many pages or content entries that share a large dependency graph.
#1769093beecc Thanks @NgoQuocViet2001! - Prevents files in directories whose names start with pages from being treated as page routes
#1767109f0dc7 Thanks @tarikermis! - Fixes astro dev refusing to start after a Docker container restart when an unrelated process reuses the PID from a persisted lock file. Astro now checks the process command across platforms, so stale lock files are cleaned up and --force does not signal the unrelated process.
#176127133730 Thanks @thelazylamaGit! - Fixes CSS hot module replacement after navigating between pages with ClientRouter
#176284ada248 Thanks @astrobot-houston! - Fixes a CSP violation when using both security.csp and experimental.clientPrerender with data-astro-prefetch links. The dynamically injected <script type="speculationrules"> now uses a static "source": "document" approach with a CSS selector, producing a deterministic payload that is hashed and included in the CSP script-src directive at build time.
#1760589e4647 Thanks @ashleigh-yeoman! - Fixes middleware HMR not responding to changes in imported modules. Previously, only direct edits to the middleware file would trigger a reload.
#17582bd2c1a5 Thanks @astrobot-houston! - Fixes a regression where content collection reference() fields silently accepted entry IDs that don’t exist, such as an ID that doesn’t match a loader’s slugified version of it. Astro now logs an error for references that point to a missing entry after all loaders finish syncing.
#1766197b0cc7 Thanks @ArmandPhilippot! - Improves Markdown options documentation with links to the Markdown guide and official processors.
#173494328c73 Thanks @astrobot-houston! - Fixes an issue where requests handled by the dev prerender environment (e.g. /_image with @astrojs/cloudflare’s prerenderEnvironment: 'node') returned a 500 when a prerendered catch-all route existed, because non-prerendered route modules were imported in an environment where their runtime-specific APIs are unavailable
#17603722eed6 Thanks @astrobot-houston! - Fixes <video> and <audio> elements being non-functional after navigating via view transitions (<ClientRouter />)
#176163a890d2 Thanks @lazerg! - Fixes experimental.incrementalBuild re-rendering unchanged routes that import more than one asset. The route’s dependency hash depended on the order the assets finished building, so two builds of identical sources could produce different hashes. The hash is now based on the file name each asset resolves to.
#17547fba468c Thanks @dmgawel! - Improves getCollection() and getEntry() performance for entries without local image references
#1760216e0d9d Thanks @astrobot-houston! - Fixes a build error caused by hash collisions in generated content collection image import identifiers
#171740224a3a Thanks @matthewp! - Adds the astro preview --background flag to start preview servers as background processes.
This makes preview servers easier to manage from scripts and AI coding agents because the command returns after the server is ready instead of keeping the terminal attached to the long-running process.
Terminal window
astropreview--background
When a preview server is running in the background, you can inspect or stop it with new astro preview subcommands:
Terminal window
astropreviewstatus
astropreviewlogs
astropreviewlogs--follow
astropreviewstop
If Astro detects that astro preview is being run by an AI coding agent, background mode is enabled automatically. This matches the existing behavior for astro dev, allowing agents to continue working after the preview server starts while still receiving the server URL and process ID.
To opt out of automatic background mode for preview servers, set ASTRO_PREVIEW_BACKGROUND=0 before running astro preview.
Previously, pointing logger.entrypoint at a custom log handler living in your own project required building an absolute URL. You can now write the path directly:
astro.config.mjs
import { defineConfig } from 'astro/config';
export default defineConfig({
logger: {
entrypoint: new URL('./src/logger.js', import.meta.url),
entrypoint: './src/logger.js',
},
});
Paths starting with ./ or ../ are resolved against your project root. Package specifiers such as @org/astro-logger, absolute paths, and URL entrypoints keep working as before.
#17084961bbe5 Thanks @matthewp! - Widens the AstroPrerendererrender() return type so prerenderers can report incremental-build metadata
A prerenderer’s render() may now resolve to either a Response (as before) or a PrerenderResult object that pairs the response with the content entries and optimized-image transforms the page resolved. This lets prerenderers that render out of process (for example, in an adapter’s runtime like workerd) report those dependencies back to the build, so incremental static builds can track and replay them for skipped pages.
This is a non-breaking widening: prerenderers that return a bare Response continue to work unchanged, and in-process prerenderers can keep returning a Response since the build collects their metadata directly.
#1687190c98ae Thanks @adamchal! - Adds session: false in astro.config to opt out of session support. Projects that do not set session: false see no behavior change.
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
session: false,
});
The session runtime and dependencies (unstorage) are now tree-shaken out of the SSR bundle for any project where no session driver is wired via:
session: false
no session config at all
a session config without a driver
Useful for serverless/edge runtimes where cold-start parse time is sensitive.
#17084961bbe5 Thanks @matthewp! - Adds experimental support for incremental static builds with experimental.incrementalBuild.
When enabled, Astro can skip regenerating static pages from dynamic routes when both the page’s module dependencies and its data cache key are unchanged from the previous build. This currently applies to pages returned from getStaticPaths() that include a cacheKey.
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
incrementalBuild: true,
},
});
Return a cacheKey for each generated page from getStaticPaths():
---
exportasyncfunctiongetStaticPaths() {
constposts=awaitfetchPosts();
return posts.map((post) => ({
params: { slug: post.slug },
props: { post },
cacheKey: post.digest,
}));
}
---
For incremental builds to skip rendering in CI, Astro’s cache directory must be preserved between builds. Astro empties the output directory on each build and restores skipped pages from the cache directory, so only that directory needs to persist. For the default config, cache and restore node_modules/.astro/ before running astro build.
#17084961bbe5 Thanks @matthewp! - Adds the optional digest property to content collection entries.
Loaders can provide an opaque digest value that changes when an entry changes. This is now reflected in the CollectionEntry type returned by getCollection() and getEntry(), making it easier to detect content changes without re-hashing large entry bodies.
---
import { getCollection } from'astro:content';
constposts=awaitgetCollection('blog');
for (constpostof posts) {
console.log(post.digest);
}
---
The property is optional because not every loader provides a digest. See incremental static builds for how digest can be used as a cacheKey.
#17529d52a787 Thanks @QVinto! - Fixes astro dev crashing with Invalid URL when --host is set to a specific non-loopback address
Vite only reports a local URL for loopback hosts. When the dev server was started with --host <custom-address> bound to a specific non-loopback address (a LAN or Tailscale IP, for example), the URL was reported under network and local was empty, so writing the dev lock file threw Invalid URL and killed a server that had already started successfully.
The lock file URL now falls back to the network URL, and a server that exposes no URL at all is left untracked rather than being taken down by lock file bookkeeping.
#17566296248c Thanks @astrobot-houston! - Fixes fontProviders.googleicons() returning the full icon font (~3.9MB) instead of only the requested glyphs when multiple experimental.glyphs are specified
#17560ef45de1 Thanks @astrobot-houston! - Fixes Astro.url.pathname for non-index pages when using build.format: 'preserve'. Previously, a page like src/pages/about-me.astro would output to dist/about-me.html but Astro.url.pathname would incorrectly return /about-me/ instead of /about-me.html.
#175730089f83 Thanks @astrobot-houston! - Fixes a Content Layer build crash that could occur when another dependency causes an older version of neotraverse to be hoisted to the project root
#17571116f700 Thanks @astrobot-houston! - Fixes cookies set via Astro.cookies.set() inside a custom 404.astro or 500.astro error page being silently dropped from the final response
#175793ea55ce Thanks @bluwy! - Supports the devEngines field in package.json when detecting the package manager for install commands
#17422e4e2037 Thanks @jiwonyoon-dev! - Fixes popover being rendered as popover="true"/popover="false" on custom elements (tag names containing a hyphen). Per the Popover API, the attribute only accepts "auto", "manual", or being absent, so boolean values are now always rendered as a bare popover attribute (or omitted), regardless of the tag name.
#175247613030 Thanks @matthewp! - Fixes a bug where an error while finalizing a request could prevent a response from being sent
#17480f61ba9c Thanks @florian-lefebvre! - Fixes a case where a custom logger.entrypoint failed to load at runtime in a built server bundle.
#17525e614b7b Thanks @matthewp! - Fixes action path resolution so that properties of a resolved action function are not treated as routable path segments
#17284c775c1f Thanks @matthewp! - Fixes a bug where the custom 404 (or 500) page was not rendered when a middleware rewrite targeted a route that returned an empty 404/500 response, and a blank page was returned instead
#17488d4f266d Thanks @emerson-d-lopes! - Fixes duplicate CSS files being emitted in server output when a prerendered page and a server-rendered page share the same styles (e.g. a shared layout importing Tailwind). The prerender and SSR environments each emitted their own copy of the same stylesheet (index.X.css and _..Y.css); the SSR build now reuses the CSS asset filename from the prerender build when the stylesheet is backed by the same CSS source modules, so only a single file is emitted.
#174724dc590c Thanks @astrobot-houston! - Adds the missing background prop to the <Image /> and <Picture /> component types. The prop already worked at runtime, but was absent from the types, causing astro check to report that background does not exist on the component props
#172920fc519d Thanks @astrobot-houston! - Fixes missing scoped styles for child components inside client:only islands in production builds
#17421f1448de Thanks @iamkaleemsajjad-hue! - Fixes session runtime errors being silently swallowed by console.error instead of routing through Astro’s logger
#17421f1448de Thanks @iamkaleemsajjad-hue! - Fixes a session being left in a partial state after a storage failure during session.regenerate(), preventing unnecessary storage reads on subsequent operations
#1751782bf7e2 Thanks @Hashim1999164! - Prevents a visible terminal window from popping up on Windows when the dev server runs in background mode. The detached child process is now spawned with windowsHide: true, so console-subsystem grandchildren (such as workerd.exe) no longer get a new focus-stealing window allocated by Windows Terminal.
#17510eaa1fb0 Thanks @astrobot-houston! - Fixes the glob() loader watcher so negation patterns like !docs/drafts/** correctly exclude files during development, matching the behavior of the initial scan. Previously, negations were treated as independent matchers, causing unrelated files (including .astro/data-store.json) to be ingested as collection entries
#17511704e570 Thanks @astrobot-houston! - Fixes TypeScript path aliases from tsconfig.json not resolving in astro.config.ts
#17427630b382 Thanks @astrobot-houston! - Fixes image optimization during astro build using too many parallel processes in CPU-limited containers. Builds now respect the container’s CPU limit, reducing peak memory usage and avoiding out-of-memory crashes.
#17445a5f7230 Thanks @ocavue! - Updates dependency cookie to v2. Cookie values made entirely of URL-safe characters are no longer percent-encoded in Set-Cookie headers; encoded values round-trip exactly as before.
#17402a89c137 Thanks @farrosfr! - Fixes a bug where mutated Astro.locals during the request lifecycle are lost and not passed to custom error pages (404.astro/500.astro)
#1740591992ef Thanks @Araluma! - Prevents an unhandled promise rejection from the prefetch fetch fallback. In WebKit (Safari), <link rel="prefetch"> is unsupported, so prefetch uses the fetch() fallback; on a flaky connection that fetch rejects with TypeError: Load failed, and because the promise was not awaited or caught, it surfaced as an unhandled rejection to the page’s global error handlers. The best-effort prefetch now swallows the failure with .catch().
When set to true, renderable entries (such as Markdown) are not rendered during content sync. Instead, rendering is deferred until the entry is actually rendered in a page, using the same on-demand path that .mdx files already use.
This reduces memory usage during astro build for large collections whose rendered output is much larger than the source — for example, Markdown that uses heavy rehype plugins like rehype-katex. Such builds could previously run out of memory while storing the eagerly-rendered HTML for every entry.
By default deferRender is false, preserving the existing behavior of rendering entries eagerly during sync so their rendered HTML can be cached across builds.
#1729630698a2 Thanks @ematipico! - Adds a new experimental collectionStorage option for controlling how the content layer persists its data store
By default, Astro serializes the entire content layer data store to a single file (.astro/data-store.json). For very large content collections, this file can grow large enough to hit platform file-size limits.
Set experimental.collectionStorage: 'chunked' to instead split the data store across many smaller, content-addressed files inside a .astro/data-store/ directory, described by a manifest:
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
collectionStorage: 'chunked',
},
});
Because each part file is named by a hash of its contents, unchanged parts keep the same name across builds and are not rewritten, and identical parts are deduplicated. The default value is 'single-file', which preserves the current behavior.
#1721444c4989 Thanks @ematipico! - Adds support for the more specific CSP directives script-src-elem, script-src-attr, style-src-elem, and style-src-attr through a new kind option.
Previously, CSP was only scoped to generic script-src/style-src directives. Now each source or hash can be scoped to a narrower directive — for example, to allow inline style attributes (such as those from define:vars or Shiki) without loosening the policy for your <style> and <link> elements.
Scoping sources and hashes in your config
Each entry in resources and hashes can be an object with a kind property. Depending on whether you use scriptDirective or styleDirective, "element" targets script-src-elem or style-src-elem, "attribute" targets script-src-attr or style-src-attr, and "default" (the same as a bare string or hash) targets script-src or style-src.
#1725884814d4 Thanks @astrobot-houston! - Adds a new format() option to the paginate utility. The format() option is a function that accepts the current URL of the page, and returns a new URL.
For example, when your host only supports URLs using the .html extension, you can use format() to add it to the generated URLs:
---
exportasyncfunctiongetStaticPaths({ paginate }) {
// Load your data with fetch(), getCollection(), etc.
// Return a paginated collection of paths for all items
returnpaginate(allPokemon, {
pageSize: 10,
format: (url) =>`${url}.html`,
});
}
const { page } = Astro.props;
---
#173317db6420 Thanks @matthewp! - Adds a --ignore-lock flag to astro dev for starting a dev server without checking or writing the lock file, so it can run alongside an already-running dev server for the same project.
The new instance is not tracked by astro dev stop, astro dev status, or astro dev logs. --ignore-lock cannot be combined with --background (or an auto-detected AI agent environment, which runs dev servers in the background automatically) or --force, since those rely on the lock file.
#173324407483 Thanks @astrobot-houston! - Fixes the JSON logger crashing with process is not defined in non-Node runtimes like Cloudflare’s workerd. The JSON logger now uses console.log/console.error instead of process.stdout/process.stderr, matching the pattern already used by the console logger.
#17391186a1e7 Thanks @florian-lefebvre! - Fixes a case where an integration could not update the logger with updateConfig()
#17394d9f99e1 Thanks @matthewp! - Fixes element-specific CSP directives to preserve the existing behavior of configured script and style resources
#17374b2d1b3e Thanks @astrobot-houston! - Fixes dev server returning 404 for ?url imported assets when accessed via browser navigation
#17390ed71eaf Thanks @florian-lefebvre! - Removes an unused and undocumented generic from the AstroLoggerDestination type
#17393092da56 Thanks @matthewp! - Hardens generated transition styles, development metadata, and server island URLs when embedding dynamic values
#17286a249317 Thanks @astrobot-houston! - Fixes the first browser visit after astro dev starts triggering an immediate full page reload
#17369a94d4a5 Thanks @adamchal! - Fixes an issue where a client island could permanently fail to hydrate if the first attempt to load its component failed. Islands now reliably recover from transient import failures, which previously did not work for React components during astro dev.
#173633f4efc5 Thanks @astrobot-houston! - Fixes astro preview --open not opening a browser when using an adapter with a custom preview entrypoint, such as @astrojs/cloudflare
#17313e2e319d Thanks @ronits2407! - Exposes the AstroRuntimeLogger interface to allow users to properly type the logger functions at runtime.
#17328025cc74 Thanks @matthewp! - Fixes astro dev --force not replacing an already-running dev server
#173532bba277 Thanks @ematipico! - Updates the Astro compiler to the latest version, which fixes many regressions. Refer to the changelog for more details.
#1734479a41e0 Thanks @adamchal! - Improves rendering performance for pages with many component instances, such as repeated MDX <Content /> components.
#1731823a4120 Thanks @astrobot-houston! - Fixes CSS module scoped-name hash mismatch in astro dev when using vite.css.transformer: 'lightningcss' with content collections. Previously, a component importing a CSS module and rendered via content collection render() would get different class name hashes in the element and the injected <style> tag, causing styles not to apply.
#173234298883 Thanks @ematipico! - Fixes a dev server memory leak which caused Node.js to emit warnings in the console.
#173234298883 Thanks @ematipico! - Fixes a dev server crash when a .html or /index.html suffixed request (such as those netlify dev probes as pretty-URL fallbacks) matched a dynamic endpoint route, causing a TypeError: Missing parameter error
#17325cebc404 Thanks @astrobot-houston! - Fixes a bug where CSS @import rules could end up mid-stylesheet after inline CSS chunks were merged during build, causing browsers to silently ignore them
#173234298883 Thanks @ematipico! - Fixes a build regression that could leave unresolved preload markers in inlined scripts with external dynamic imports
#1726179aa99c Thanks @astrobot-houston! - Fixes a false deprecation warning for markdown.gfm and markdown.smartypants when using the Container API
#17247f94280d Thanks @chatman-media! - Fixes route generation throwing “Missing parameter” (or silently dropping the segment) when a dynamic param’s value is 0. The generator used truthy checks instead of checking for undefined, so paginate(posts, { params: { categoryId: 0 } }) would crash even though 0 is a perfectly valid param value.
#172786f11739 Thanks @astrobot-houston! - Fixes missing CSS for virtual style modules (e.g., responsive image layout styles) in dev mode when JavaScript is disabled
#172500b30b35 Thanks @matthewp! - Fixes the security.checkOrigin check so it is applied consistently to Astro Actions and on-demand endpoints, regardless of how the request pipeline is composed. Previously, the origin check could be skipped in the composable astro/hono pipeline depending on the order of the middleware() primitive (or when it was omitted).
#172748c3579b Thanks @astrobot-houston! - Fixes missing render() type overload for live collection entries. Previously, calling render() on a LiveDataEntry produced a TypeScript error when using only live.config.ts without a content.config.ts.
#172574208297 Thanks @astrobot-houston! - Fixes astro check failing to find @astrojs/check and typescript when astro is installed in a directory outside the project tree (e.g. pnpm virtual store)
#17272b428648 Thanks @matthewp! - Fixes island component paths so that extensionless imports (e.g. import { Counter } from '../components/Counter') resolve to the real file on disk, matching Vite’s extension order and directory index resolution. This makes the include/exclude options of JSX renderer integrations (React, Preact, Solid) match components imported without a file extension, and removes the spurious React 19 “Invalid hook call” warning logged on every request in dev when include was set alongside another JSX renderer
#172792aeaa44 Thanks @astrobot-houston! - Fixes a bug where <Picture inferSize> with a remote image could fail with FailedToFetchRemoteImageDimensions when the image server rate-limits requests (e.g. HTTP 429). Remote dimensions are now resolved once per render instead of once per output format.
#172515240e26 Thanks @matthewp! - Hardens the handling of attribute rendering when using with custom elements.
#17248429bd62 Thanks @astrobot-houston! - Fixes a crash when using Astro’s getViteConfig with Vitest browser mode (e.g., Storybook vitest runner). Astro now skips dev server setup inside Vitest, preventing errors.
#1726014524c0 Thanks @matthewp! - Fixes a regression where a <script> inside a component rendered through Astro.slots.render() was hoisted out of its original position instead of staying next to its component content
#172429c05ba4 Thanks @matthewp! - Fixes an error that could occur after the dev server restarts when using an adapter such as @astrojs/cloudflare, where a request would fail with a 500 referencing a missing pre-bundled dependency:
The file does not exist at "node_modules/.vite/deps_ssr/astro_compiler-runtime.js?v=6419660d" which is in the optimize deps directory. The dependency might be incompatible with the dep optimizer. Try adding it to `optimizeDeps.exclude`.
#17202c6d254d Thanks @matthewp! - Refactors path alias resolution to use Vite’s native tsconfigPaths option
This is an internal change with no expected impact on user projects. Astro now defers tsconfig and jsconfig paths alias resolution to Vite, keeping a small fallback for a few CSS cases Vite does not yet handle.
#1712372e29bd Thanks @martrapp! - Fixes an issue where the ClientRouter wipes head elements after page transitions if the <head> contains a server:defer component.
#17232257505e Thanks @matthewp! - Fixes a bug where <style> tags from components such as a content collection’s Content could be silently dropped from the output when an await appeared before the component in an .astro file’s markup.
#17193a7352fd Thanks @jan-kubica! - Fixes the background dev server failing to start when astro is hoisted outside the project’s node_modules (for example bun workspaces). The background process is now spawned from Astro’s own resolved location instead of a path assumed under the project root.
#172127ba0bb1 Thanks @matthewp! - Ensures transition directive values are HTML-escaped when rendered on hydrated islands
#17224dc5e52f Thanks @astrobot-houston! - Fixes trailing slash handling for dynamic file endpoints in dev mode. Dynamic file endpoints (e.g., src/pages/api/[name].json.ts) with trailingSlash: "always" incorrectly required a trailing slash in dev mode, returning 404 for /api/bar.json and 200 for /api/bar.json/.
#1706723f9446 Thanks @fkatsuhiro! - Fixed a bug where the development toolbar did not output a warning even though the implicit ARIA role and the manually specified role were duplicated.
#172235970ef4 Thanks @astrobot-houston! - Fixes getCollection() returning empty in dev mode for large content collections (500k+ entries)
#17184799e5cd Thanks @Princesseuh! - Upgrades the Rust compiler to the latest, which fixes some bugs. Refer to its changelog for more information.
#17208da8b573 Thanks @matthewp! - Hardens forwarded header handling so the internal request helper validates X-Forwarded-Host against security.allowedDomains before trusting X-Forwarded-For for clientAddress. Previously it only checked that the header was present, which was inconsistent with the public createRequest helper. This aligns both code paths; behavior is unchanged for correctly configured proxies.
#1718924d2c9e Thanks @astrobot-houston! - Fixes a bug where an error thrown inside one route’s getStaticPaths() would prevent other valid routes from being matched in dev mode
#169328f4a3db Thanks @fkatsuhiro! - Fixes HMR for action files during development. Editing files in src/actions/ now takes effect on the next request without requiring a dev server restart.
#17087fb0ab02 Thanks @jp-knj! - Fixes localized custom error pages in i18n projects so routes like /pt/404 are used for missing localized pages and return the correct status code
#17151ccceda3 Thanks @matthewp! - Fixes astro dev incorrectly starting in background mode for Warp terminal users. Hybrid environments like Warp are no longer treated as AI agents for auto-background detection.
#17158164df87 Thanks @ematipico! - Fixes astro dev --background --host not listing the network addresses. The background server start output and astro dev status now show every exposed network URL, matching the foreground dev server.
#17141d785b9d Thanks @astrobot-houston! - Fixes responsive image CSS overriding user styles defined inside CSS @layer blocks. The generated image styles are now wrapped in @layer astro.images, ensuring they have lower cascade priority than user-defined layers.
#171501a61386 Thanks @matthewp! - Fixes astro dev --background failing on Windows with “Failed to spawn background dev server process”
Astro now strips whitespace from your HTML using JSX rules by default, the same way frameworks like React do. Whitespace and line breaks around elements are removed, but meaningful whitespace within a single line — like a space between two inline elements — is preserved. To keep a space that would otherwise be removed, write it explicitly in your source, for example with {" "}.
This can change rendered output where whitespace between inline elements was previously meaningful. To keep Astro’s earlier behavior, set compressHTML: true for HTML-aware compression, or compressHTML: false to preserve all whitespace.
#16610c63e7e4 Thanks @matthewp! - Adds background dev server management for AI coding agents.
When an AI coding agent is detected, astro dev now automatically starts the dev server as a detached background process. This prevents the dev server from blocking the agent’s terminal and allows it to continue working while the server runs.
A lock file (.astro/dev.json) is written when the dev server starts, recording the server’s URL, port, and PID. This prevents duplicate servers from being started for the same project.
New flag and subcommands
astro dev --background — Start the dev server as a background process (this is what runs automatically when an agent is detected).
astro dev stop — Stop a running background dev server.
astro dev status — Check if a dev server is running and display its URL, PID, and uptime.
astro dev logs — View logs from a background dev server. Use --follow (-f) to stream new output as it’s written.
These allow you to start and manage dev servers programmatically and were designed with AI coding agents in mind.
What should I do?
No action is required. If you are not using an AI coding agent, astro dev behaves exactly as before. If you are using an agent, background mode is enabled automatically — the agent will receive the server URL and PID, and can use astro dev stop to shut it down.
To opt out of automatic background mode when an agent is detected, set the environment variable ASTRO_DEV_BACKGROUND=0 before running astro dev.
#170100606073 Thanks @ocavue! - Removes the @astrojs/db package as it is no longer maintained.
The @astrojs/db package were deprecated in v6.4.5 and is now removed. This means the astro db, astro login, astro logout, astro link, and astro init CLI commands have also been removed.
If you were using Astro DB in your project, remove @astrojs/db from your project’s dependencies and replace it with one of the following alternatives:
Node.js built-in SQLite: Node.js now includes a built-in node:sqlite module (available since Node.js v22.5.0). This is a good option if you are using the Node.js adapter and were using @astrojs/db for local SQLite storage.
Drizzle ORM: If you were using @astrojs/db for its Drizzle-based schema and query API, you can use Drizzle directly with any supported database.
Other database libraries: Use any database library that suits your deployment platform (e.g. Turso, PlanetScale, Neon).
The Rust-based Astro compiler (@astrojs/compiler-rs) is now the default compiler. This new compiler is faster and more reliable, leading to faster build times and iteration cycles during development.
This new compiler is more strict regarding invalid syntax. For example, unclosed HTML tags will now throw an error instead of being ignored. It also does not attempt to correct semantically invalid HTML anymore, instead leaving it to the browser to handle, similar to other tools or document.write() in JavaScript.
The previous Go-based compiler has been removed, along with the experimental.rustCompiler flag used to opt into the Rust compiler. If you were setting experimental.rustCompiler in your astro.config.mjs, you can now remove it. No other action is required.
Astro now renders .md files with satteri() from @astrojs/markdown-satteri, its native Markdown pipeline, instead of the remark/rehype pipeline. @astrojs/markdown-remark is no longer installed by default.
To keep using the remark/rehype pipeline, install @astrojs/markdown-remark and set it as your processor:
The deprecated markdown.remarkPlugins, markdown.rehypePlugins, and markdown.remarkRehype options still work, but now require @astrojs/markdown-remark to be used.
The advanced routing feature introduced behind a flag in v6.3.0 is no longer experimental and is now enabled by default.
This gives full control over how requests flow through your application, with first-class support for frameworks like Hono.
Advanced routing now uses src/fetch.ts as default entrypoint instead of src/app.ts.
If you were previously using this feature without a custom entrypoint, please configure fetchFile or rename your entrypoint to src/fetch.ts, and then remove the experimental flag from your Astro config:
import { defineConfig } from 'astro/config';
export default defineConfig({
experimental {
advancedRouting: true,
},
fetchFile: 'app.ts' // optional, you only need this if you cannot rename your entrypoint.
});
fetchFile is now a top-level config option instead of being nested under experimental.advancedRouting. If you were using a custom entrypoint, please update your Astro config to move its configuration:
astro.config.mjs
export default defineConfig({
experimental: {
advancedRouting: {
fetchFile: 'my-custom-entrypoint.ts',
},
},
fetchFile: 'my-custom-entrypoint.ts',
})
You can also set fetchFile: null to disable the entrypoint if you are using src/fetch.ts for another purpose, or don’t need advanced routing features.
If you have been waiting for stabilization before using advanced routing, you can now do so.
#1699857dcc31 Thanks @matthewp! - Exposes getFetchState() from astro/hono as a public API
The getFetchState() function retrieves or lazily creates a FetchState from a Hono context object. This allows third-party packages to build Hono middleware that interacts with Astro’s per-request state, giving the astro/hono API the same extensibility as astro/fetch.
import { Hono } from'hono';
import { getFetchState, pages } from'astro/hono';
constapp=newHono();
app.use(async (context, next) => {
conststate=getFetchState(context);
state.locals.message ='Hello from custom middleware';
awaitnext();
});
app.use(pages());
exportdefault app;
#16996300641e Thanks @florian-lefebvre! - Adds a subset field to the FontData type exposed via fontData from astro:assets. When using multiple font subsets (e.g., subsets: ["latin", "korean"]), each font data entry now includes the subset name, making it possible to distinguish between font entries for different subsets that share the same weight and style.
#16745f864a80 Thanks @ematipico! - The custom logger feature introduced behind a flag in v6.2.0 is no longer experimental and is available for general use.
This feature provides better control over Astro’s logging infrastructure by allowing you to replace the default console output with custom logging implementations (e.g., structured JSON). This is particularly useful for on-demand rendering when connecting to log aggregation services such as Kibana, Logstash, CloudWatch, Grafana, or Loki.
Astro provides three built-in log handlers (json, node, and console), and you can also create your own.
Additionally, context.logger is now always available in API routes and middleware, even without a custom logger configured.
If you were previously using this feature, please remove the experimental flag from your Astro config:
import { defineConfig } from 'astro/config';
export default defineConfig({
experimental: {
logger: {
entrypoint: '@org/custom-logger',
},
},
logger: {
entrypoint: '@org/custom-logger',
},
});
If you have been waiting for stabilization before using custom loggers, you can now do so.
Please see the Logger docs for more about this feature.
#169810d6d644 Thanks @ematipico! - Removes the setting experimental.queuedRendering. The new rendering engine is now stable and replaces the old one.
As part of the stabilization, the queued rendering has been improved, and some features have been removed:
The construction of the queue has been removed, instead now Astro uses a streaming approach where components are rendered and flushed as they are encountered.
The node polling feature has been removed because it doesn’t yield concrete savings.
The content cache has been descoped, and how only tag names are cached.
If you were previously using this experimental feature, you must remove this experimental flag from your configuration as it no longer exists:
astro.config.mjs
import { defineConfig } from "astro/config";
export default defineConfig({
experimental: {
queuedRendering: {}
}
});
#17116f95e58e Thanks @ascorbic! - Stabilizes route caching, removing the experimental.cache and experimental.routeRules flags and replacing them with the top-level cache and routeRules configuration options.
Route caching, introduced experimentally in v6.0.0, is now stable. It gives you a platform-agnostic way to cache responses from on-demand rendered pages and endpoints, based on standard HTTP caching semantics.
Update your config to move cache and routeRules out of the experimental block:
astro.config.mjs
import { defineConfig, memoryCache } from 'astro/config';
export default defineConfig({
experimental: {
cache: {
provider: memoryCache(),
},
routeRules: {
'/blog/[...path]': { maxAge: 300, swr: 60 },
},
},
cache: {
provider: memoryCache(),
},
routeRules: {
'/blog/[...path]': { maxAge: 300, swr: 60 },
},
});
Set caching directives in your routes with Astro.cache (in .astro pages) or context.cache (in API routes and middleware), and Astro translates them into the appropriate headers or runtime behavior depending on your configured cache provider. You can also define cache rules for routes declaratively in your config using routeRules, without modifying route code.
#169801f07343 Thanks @matthewp! - Removes state.provide(), state.resolve(), state.finalizeAll(), and App.Providers from the public advanced routing API. These context provider extension points are now internal-only. If you were using them in an integration, use locals to share per-request state instead.
#169821e000e2 Thanks @matthewp! - Improves the warning when accessing Astro.session without session storage configured. The session property is now always defined on the context object, and accessing it without configuration logs a helpful message instead of silently returning undefined.
Exports astro/cache/provider-utils with helpers for building platform-specific cache-control headers, generating path-based invalidation tags, and normalizing invalidation options. These are used internally by the first-party Netlify, Vercel, and Cloudflare cache providers.
#17095e84ebc0 Thanks @matthewp! - Improves build performance by removing an unfiltered transform hook from the astro:head-metadata-build plugin. Head propagation modules are now identified by their module ID (?astroPropagatedAssets) instead of scanning every module’s source code.
#170414c4a91c Thanks @iseraph-dev! - Fixes a bug where the advanced routing astro/hono / astro/fetchpages() handler returned the host framework’s default Internal Server Error response instead of rendering the custom 500.astro page when a page threw during render. Unmatched requests with a prerendered (or absent) custom 404 page now render the 404 error page instead of failing the same way.
#170975e340d7 Thanks @iseraph-dev! - Fixes a bug where the advanced routing astro/hono / astro/fetchmiddleware() handler returned the host framework’s default Internal Server Error response instead of rendering the custom 500.astro page when middleware threw. Unmatched requests with a prerendered (or absent) custom 404 page now render the 404 error page instead of failing the same way. Errors surfaced through next (the host framework’s downstream chain) still propagate to the host’s own error handler.
#15819cafec4e Thanks @delucis! - Fixes --port flag being ignored after a Vite-triggered server restart (e.g. when a .env file changes)
#17104b074a37 Thanks @iseraph-dev! - Fixes the custom 500.astro page receiving an empty error prop when the error originated in middleware.
#1707804547ec Thanks @astrobot-houston! - Fixes a spurious Astro.request.headers warning on prerendered pages when security.allowedDomains is configured. The internal allowedDomains header validation now skips prerendered routes, since they use synthetic requests with no real headers.
#16603deaaf3f Thanks @alexanderniebuhr! - Removes the warning that Astro does not support vite v8, since Astro v7 does support vite v8
Cache providers now receive the incoming Request as a second argument to setHeaders(options, request). This allows CDN providers to read the request URL, headers, and other properties when generating cache response headers, for example to auto-tag responses with their pathname for path-based invalidation.
#17098637a1b6 Thanks @matthewp! - Fixes internal Astro headers leaking from direct pages() handler responses
#17116f95e58e Thanks @ascorbic! - Stabilizes route caching, removing the experimental.cache and experimental.routeRules flags and replacing them with the top-level cache and routeRules configuration options.
Route caching, introduced experimentally in v6.0.0, is now stable. It gives you a platform-agnostic way to cache responses from on-demand rendered pages and endpoints, based on standard HTTP caching semantics.
Update your config to move cache and routeRules out of the experimental block:
astro.config.mjs
import { defineConfig, memoryCache } from 'astro/config';
export default defineConfig({
experimental: {
cache: {
provider: memoryCache(),
},
routeRules: {
'/blog/[...path]': { maxAge: 300, swr: 60 },
},
},
cache: {
provider: memoryCache(),
},
routeRules: {
'/blog/[...path]': { maxAge: 300, swr: 60 },
},
});
Set caching directives in your routes with Astro.cache (in .astro pages) or context.cache (in API routes and middleware), and Astro translates them into the appropriate headers or runtime behavior depending on your configured cache provider. You can also define cache rules for routes declaratively in your config using routeRules, without modifying route code.
Astro now strips whitespace from your HTML using JSX rules by default, the same way frameworks like React do. Whitespace and line breaks around elements are removed, but meaningful whitespace within a single line — like a space between two inline elements — is preserved. To keep a space that would otherwise be removed, write it explicitly in your source, for example with {" "}.
This can change rendered output where whitespace between inline elements was previously meaningful. To keep Astro’s earlier behavior, set compressHTML: true for HTML-aware compression, or compressHTML: false to preserve all whitespace.
#17095e84ebc0 Thanks @matthewp! - Improves build performance by removing an unfiltered transform hook from the astro:head-metadata-build plugin. Head propagation modules are now identified by their module ID (?astroPropagatedAssets) instead of scanning every module’s source code.
#170414c4a91c Thanks @iseraph-dev! - Fixes a bug where the advanced routing astro/hono / astro/fetchpages() handler returned the host framework’s default Internal Server Error response instead of rendering the custom 500.astro page when a page threw during render. Unmatched requests with a prerendered (or absent) custom 404 page now render the 404 error page instead of failing the same way.
#170975e340d7 Thanks @iseraph-dev! - Fixes a bug where the advanced routing astro/hono / astro/fetchmiddleware() handler returned the host framework’s default Internal Server Error response instead of rendering the custom 500.astro page when middleware threw. Unmatched requests with a prerendered (or absent) custom 404 page now render the 404 error page instead of failing the same way. Errors surfaced through next (the host framework’s downstream chain) still propagate to the host’s own error handler.
#17104b074a37 Thanks @iseraph-dev! - Fixes the custom 500.astro page receiving an empty error prop when the error originated in middleware.
#17098637a1b6 Thanks @matthewp! - Fixes internal Astro headers leaking from direct pages() handler responses
Astro now renders .md files with satteri() from @astrojs/markdown-satteri, its native Markdown pipeline, instead of the remark/rehype pipeline. @astrojs/markdown-remark is no longer installed by default.
To keep using the remark/rehype pipeline, install @astrojs/markdown-remark and set it as your processor:
The deprecated markdown.remarkPlugins, markdown.rehypePlugins, and markdown.remarkRehype options still work, but now require @astrojs/markdown-remark to be used.
🐞 Patch Changes
#1707804547ec Thanks @astrobot-houston! - Fixes a spurious Astro.request.headers warning on prerendered pages when security.allowedDomains is configured. The internal allowedDomains header validation now skips prerendered routes, since they use synthetic requests with no real headers.
#17035197e50e Thanks @astrobot-houston! - Fixes getRelativeLocaleUrl, getAbsoluteLocaleUrl, and getAbsoluteLocaleUrlList to strip trailing slashes when trailingSlash: 'never' is configured
Previously, any URL containing a double-encoded character (like %255B, which is [ encoded twice) was unconditionally rejected with a 400 Bad Request before middleware or route handlers could run. This broke embedded tools like Sanity Studio whose client-side router legitimately produces double-encoded URLs.
The fix replaces the rejection approach with iterative decoding — multi-level percent-encoding is now fully resolved to its canonical form before being passed to middleware and route matching. This preserves the security fix for CVE-2025-66202 (middleware authorization bypass via double encoding) because middleware now always sees the fully decoded path, making bypass impossible. For example, /api/%2561dmin is decoded to /api/admin, which middleware can correctly block.
#170662f4d92a Thanks @matthewp! - Fixes prerendered redirect targets being incorrectly bundled into the SSR function in hybrid mode, causing massive bundle size inflation
#16882621beb7 Thanks @jettwayio! - fix(render): honour compressHTML when joining head elements
#168928d753b0 Thanks @astrobot-houston! - Fixes custom elements in MDX having their children’s slot attribute stripped by the JSX runtime
When custom elements (tags with hyphens like <my-element>) are used in MDX files, the slot HTML attribute on their children is now correctly preserved. Previously, the shared JSX runtime would treat slot as an Astro slot assignment and remove it from the output, breaking Shadow DOM named slot distribution for web components.
#16957544ee76 Thanks @thelazylamaGit! - Fixes stale inline CSS in server-rendered HTML after CSS file edits during dev
When editing a CSS file (.css, .scss, etc.) during development, the inline <style> tags in server-rendered HTML would retain old CSS content instead of updating. This caused a brief flash of old CSS (FOUC) on fresh page loads before Vite’s client-side HMR corrected the styles.
The fix ensures that Astro’s per-route dev CSS virtual modules are invalidated in both the SSR module graph and the module runner’s evaluation cache when a style file changes, so the next page render picks up the fresh CSS.
#170442220d22 Thanks @astrobot-houston! - Fixes CSS from client:only islands leaking to unrelated pages when Rollup bundles non-CSS-importing modules into the same chunk as CSS-importing modules
#170407c4763d Thanks @astrobot-houston! - Fixes HMR not triggering for files inside the src/middleware/ directory during dev
#1667252fc862 Thanks @martinheidegger! - Fixes support for numeric IDs in YAML frontmatter when using content collection references
#167629de80ae Thanks @alexanderdombroski! - Adds a JSON schema to the Wrangler configuration file generated when running astro add cloudflare
#17046ef771ec Thanks @ematipico! - Improves the diagnostics emitted when Astro parses incorrect .astro files.
#16765b10e86e Thanks @fkatsuhiro! - Fixes an issue where renaming an image file while the dev server is running triggers a build error. Now Astro correctly hot-reloads the image without crashing.
#17026add3df1 Thanks @matthewp! - Hardens addAttribute to drop attribute names containing characters that are invalid per the HTML spec (", ', >, /, =, whitespace)
#17033ffda27b Thanks @matthewp! - Validates the request origin against allowedDomains before fetching prerendered error pages. When allowedDomains is configured and the Host header matches, the original origin is used. Otherwise, the fetch falls back to localhost.
The advanced routing feature introduced behind a flag in v6.3.0 is no longer experimental and is now enabled by default.
This gives full control over how requests flow through your application, with first-class support for frameworks like Hono.
Advanced routing now uses src/fetch.ts as default entrypoint instead of src/app.ts.
If you were previously using this feature without a custom entrypoint, please configure fetchFile or rename your entrypoint to src/fetch.ts, and then remove the experimental flag from your Astro config:
import { defineConfig } from 'astro/config';
export default defineConfig({
experimental {
advancedRouting: true,
},
fetchFile: 'app.ts' // optional, you only need this if you cannot rename your entrypoint.
});
fetchFile is now a top-level config option instead of being nested under experimental.advancedRouting. If you were using a custom entrypoint, please update your Astro config to move its configuration:
astro.config.mjs
export default defineConfig({
experimental: {
advancedRouting: {
fetchFile: 'my-custom-entrypoint.ts',
},
},
fetchFile: 'my-custom-entrypoint.ts',
})
You can also set fetchFile: null to disable the entrypoint if you are using src/fetch.ts for another purpose, or don’t need advanced routing features.
If you have been waiting for stabilization before using advanced routing, you can now do so.
#1699857dcc31 Thanks @matthewp! - Exposes getFetchState() from astro/hono as a public API
The getFetchState() function retrieves or lazily creates a FetchState from a Hono context object. This allows third-party packages to build Hono middleware that interacts with Astro’s per-request state, giving the astro/hono API the same extensibility as astro/fetch.
import { Hono } from'hono';
import { getFetchState, pages } from'astro/hono';
constapp=newHono();
app.use(async (context, next) => {
conststate=getFetchState(context);
state.locals.message ='Hello from custom middleware';
awaitnext();
});
app.use(pages());
exportdefault app;
#16996300641e Thanks @florian-lefebvre! - Adds a subset field to the FontData type exposed via fontData from astro:assets. When using multiple font subsets (e.g., subsets: ["latin", "korean"]), each font data entry now includes the subset name, making it possible to distinguish between font entries for different subsets that share the same weight and style.
#16745f864a80 Thanks @ematipico! - The custom logger feature introduced behind a flag in v6.2.0 is no longer experimental and is available for general use.
This feature provides better control over Astro’s logging infrastructure by allowing you to replace the default console output with custom logging implementations (e.g., structured JSON). This is particularly useful for on-demand rendering when connecting to log aggregation services such as Kibana, Logstash, CloudWatch, Grafana, or Loki.
Astro provides three built-in log handlers (json, node, and console), and you can also create your own.
Additionally, context.logger is now always available in API routes and middleware, even without a custom logger configured.
If you were previously using this feature, please remove the experimental flag from your Astro config:
import { defineConfig } from 'astro/config';
export default defineConfig({
experimental: {
logger: {
entrypoint: '@org/custom-logger',
},
},
logger: {
entrypoint: '@org/custom-logger',
},
});
If you have been waiting for stabilization before using custom loggers, you can now do so.
Please see the Logger docs for more about this feature.
#169810d6d644 Thanks @ematipico! - Removes the setting experimental.queuedRendering. The new rendering engine is now stable and replaces the old one.
As part of the stabilization, the queued rendering has been improved, and some features have been removed:
The construction of the queue has been removed, instead now Astro uses a streaming approach where components are rendered and flushed as they are encountered.
The node polling feature has been removed because it doesn’t yield concrete savings.
The content cache has been descoped, and how only tag names are cached.
If you were previously using this experimental feature, you must remove this experimental flag from your configuration as it no longer exists:
#169854ecff32 Thanks @maximslo! - Fixes the experimental.logger destination not being used for the “Server listening on…” startup message. The logger is now resolved before the server starts listening, and adapterLogger re-creates itself when the underlying logger changes so the startup message uses the correct destination.
#16947e0703a6 Thanks @ematipico! - Fixes Astro.request.url not reflecting validated X-Forwarded-Proto/X-Forwarded-Host headers when security.allowedDomains is configured. Previously, only Astro.url was updated with the forwarded origin while Astro.request.url retained the socket-derived URL, causing the two to diverge behind TLS-terminating proxies.
#16997dc45246 Thanks @matthewp! - Reverts a change to isNode runtime detection that caused a significant build time regression for Cloudflare adapter users with large prerendered sites
#16610c63e7e4 Thanks @matthewp! - Adds background dev server management for AI coding agents.
When an AI coding agent is detected, astro dev now automatically starts the dev server as a detached background process. This prevents the dev server from blocking the agent’s terminal and allows it to continue working while the server runs.
A lock file (.astro/dev.json) is written when the dev server starts, recording the server’s URL, port, and PID. This prevents duplicate servers from being started for the same project.
New flag and subcommands
astro dev --background — Start the dev server as a background process (this is what runs automatically when an agent is detected).
astro dev stop — Stop a running background dev server.
astro dev status — Check if a dev server is running and display its URL, PID, and uptime.
astro dev logs — View logs from a background dev server. Use --follow (-f) to stream new output as it’s written.
These allow you to start and manage dev servers programmatically and were designed with AI coding agents in mind.
What should I do?
No action is required. If you are not using an AI coding agent, astro dev behaves exactly as before. If you are using an agent, background mode is enabled automatically — the agent will receive the server URL and PID, and can use astro dev stop to shut it down.
To opt out of automatic background mode when an agent is detected, set the environment variable ASTRO_DEV_BACKGROUND=0 before running astro dev.
#169801f07343 Thanks @matthewp! - Removes state.provide(), state.resolve(), state.finalizeAll(), and App.Providers from the public advanced routing API. These context provider extension points are now internal-only. If you were using them in an integration, use locals to share per-request state instead.
#169821e000e2 Thanks @matthewp! - Improves the warning when accessing Astro.session without session storage configured. The session property is now always defined on the context object, and accessing it without configuration logs a helpful message instead of silently returning undefined.
#16990ebeb830 Thanks @ocavue! - Fixes Astro.request.url not reflecting validated X-Forwarded-Proto/X-Forwarded-Host headers when security.allowedDomains is configured. Previously, only Astro.url was updated with the forwarded origin while Astro.request.url retained the socket-derived URL, causing the two to diverge behind TLS-terminating proxies.
#169261b39ae8 Thanks @narendraio! - Prevents App.match() from throwing on request paths that contain an invalid percent-sequence.
#169242c0bc94 Thanks @astrobot-houston! - Fixes an issue where editing a client-side component (e.g. with client:idle, client:load, etc.) caused an unnecessary full program reload of the backend during development.
#169582c1d50f Thanks @fkatsuhiro! - Fixes a bug where static file endpoints using getStaticPaths with .html in dynamic param values (e.g. { path: 'file.html' }) would fail with a NoMatchingStaticPathFound error during build. The .html suffix is no longer incorrectly stripped from endpoint route pathnames.
#16855c610cda Thanks @astrobot-houston! - Fixes dynamic routes returning 500 “TypeError: Missing parameter” when using domain-based i18n routing in SSR.
#16946606c37b Thanks @ematipico! - Fixes Astro.routePattern to preserve original casing of dynamic parameter names from filenames. Previously, a file at src/pages/blog/[postId].astro would return /blog/[postid] for Astro.routePattern due to an internal .toLowerCase() call. It now correctly returns /blog/[postId].
#1672016d49b6 Thanks @thomas-callahan-collibra! - Fix an issue where dynamic routes would return the string [object Object] instead of the expected content, in certain runtimes.
#1670317390a6 Thanks @henrybrewer00-dotcom! - Fixes styles being stripped when the project root is started with a path whose case differs from the actual filesystem case (e.g. running astro dev from d:\dev\app while the folder on disk is D:\dev\app).
#16855c610cda Thanks @astrobot-houston! - Fixes Astro.currentLocale returning the default locale instead of the domain’s locale on dynamic routes served from a mapped domain.
#160160d85e1b Thanks @felmonon! - Fix a false positive in the dev toolbar accessibility audit for anchors with text inside closed <details> elements.
#1691179c6c46 Thanks @astrobot-houston! - Fixes a bug where experimental.advancedRouting with astro/hono handlers threw TypeError: Cannot read properties of undefined (reading 'route') for unmatched routes instead of rendering the custom 404 page.
#16899239c469 Thanks @matthewp! - Fixes a false “does not call the middleware() handler” warning when using astro() in a custom src/app.ts and the first request is a redirect route.
#16887493acdb Thanks @astrobot-houston! - Fixes redirectToDefaultLocale not working after the Advanced Routing refactoring.
#16908ef53ab9 Thanks @florian-lefebvre! - Improves optimized fallbacks generation when using the Fonts API by using better metrics for bold variants
#16889b94bcfd Thanks @Princesseuh! - Fixes a plugins is not iterable crash when using a pre-6.0 @astrojs/mdx alongside integrations (e.g. Starlight) that set markdown.remarkPlugins, markdown.rehypePlugins, or markdown.remarkRehype.
#16878b9f6bb9 Thanks @fkatsuhiro! - Fixes an issue where on-demand (SSR) dynamic routes would return 404 when a prerendered dynamic route with the same URL pattern was sorted first alphabetically. In production builds with @astrojs/node adapter, if [a_prebuild].astro (prerender=true) came before [b_ssr].astro alphabetically, requests to URLs not in the prerendered route’s static paths would 404 instead of falling through to the SSR route. The fix adds fallthrough logic so that when a prerendered dynamic route matches but can’t serve the request, Astro tries subsequent matching routes.
Adapters can now set preserveBuildServerDir: true in their adapter features to keep the dist/server/ directory structure for static builds, mirroring the existing preserveBuildClientDir option. This is useful for adapters that require a consistent dist/client/ and dist/server/ layout regardless of build output type.
setAdapter({
name: 'my-adapter',
adapterFeatures: {
buildOutput,
preserveBuildClientDir: true,
preserveBuildServerDir: true,
},
});
#16848f732f3c Thanks @Princesseuh! - Adds a new markdown.processor configuration option, allowing you to choose an alternative Markdown processor.
Websites with many Markdown/MDX files tend to be slow to build because the unified ecosystem (e.g., remark, rehype) is slow to process. This feature introduces the ability to replace this part of the build pipeline with another processor.
The default processor is unified(). This means that existing configurations remain unchanged and your remark/rehype plugins continue to work.
In addition to this new configuration option, Astro provides a new alternative processor based on Rust: Sätteri. You can choose to use it now by installing @astrojs/markdown-satteri, importing the satteri() processor, and adapting your existing configuration:
This processor does not support the remark and rehype plugins. This means you may need to convert them to MDAST or HAST plugins to retain your current functionality.
The existing top-level markdown.remarkPlugins, markdown.rehypePlugins, markdown.remarkRehype, markdown.gfm, and markdown.smartypants options still work, but are now deprecated and will be removed in a future major update. The matching remarkPlugins, rehypePlugins, and remarkRehype options on the MDX integration are also deprecated for the same reason. To anticipate their removal, move them onto unified({...}) (or your preferred plugin processor) :
astro.config.mjs
import { defineConfig } from 'astro/config';
import remarkToc from 'remark-toc';
import rehypeSlug from 'rehype-slug';
import { unified } from '@astrojs/markdown-remark';
#164684cff3a1 Thanks @matthewp! - Skips the static preview server when an adapter provides its own previewEntrypoint, allowing the adapter to handle both static and dynamic routes
#16811e0e26db Thanks @matthewp! - Fixes X-Forwarded-Host and X-Forwarded-Proto headers being ignored when set in a custom src/app.ts fetch handler before creating FetchState
#164684cff3a1 Thanks @matthewp! - Fixes the static preview server to respect preserveBuildClientDir, serving files from build.client instead of outDir when the adapter requires it
#167701e2aa11 Thanks @matthewp! - Fixes a race condition where the Vite dep optimizer could lose React dependencies in dev mode when using Astro Actions
#164684cff3a1 Thanks @matthewp! - Exempts internal routes (e.g. server islands) from getStaticPaths() validation, fixing server island rendering on static sites
#164684cff3a1 Thanks @matthewp! - Fixes preview for static sites that contain non-prerendered routes. Previously, the preview command ignored SSR routes discovered during route scanning and always used the static preview server.
#16830f2bf3cb Thanks @matthewp! - Fixes 404s for dynamically imported JS chunks when using an adapter with assetQueryParams (e.g. Vercel skew protection)
#16831ace96ba Thanks @astrobot-houston! - Fixes a misleading GetStaticPathsRequired error when a redirect is configured from a dynamic route to a static (or less-dynamic) destination. For example, '/project/[slug]': '/' previously produced a confusing error pointing at index.astro. Astro now detects the parameter mismatch at config validation time and throws a clear InvalidRedirectDestination error naming the missing parameters.
#16702b7d1758 Thanks @matthewp! - Fixes scoped styles from .astro components being dropped when rendered inside MDX content (<Content /> from render(entry)) passed through a named slot using <Fragment slot="X">. The Fragment component now eagerly evaluates its slot contents to ensure propagating components register their styles before head content is flushed.
#168233df6a45 Thanks @astrobot-houston! - Fixes missing CSS for conditionally rendered Svelte components in production builds
#168363d7adfa Thanks @LongYC! - Document compressHTML: “jsx” config is only available since Astro v6.2.0
#16864334ce13 Thanks @cheets! - Fixes a false-positive Internal Warning: route cache overwritten logged on every SSR request for dynamic routes
#168138f7d8c4 Thanks @matthewp! - Populates styles in the SSR manifest for prerendered routes. Previously, prerendered routes had styles: [] in the manifest, making it impossible for workers or middleware to discover which CSS files a prerendered page uses.
#168219c76b12 Thanks @astrobot-houston! - Fixes request body handling in the Node adapter when req.body is a Buffer, Uint8Array, or ArrayBuffer. Previously, binary body data was incorrectly JSON-stringified (producing {"type":"Buffer","data":[...]}) instead of being passed through directly. This affected libraries like serverless-http that set req.body to a Buffer.
#16785de96360 Thanks @astrobot-houston! - Fixes vite.build.minify, vite.build.sourcemap, and vite.build.rollupOptions.output (e.g. compact) being ignored for client-side builds. These top-level Vite build options are now properly forwarded to the client environment, with environment-specific overrides (vite.environments.client.build.*) taking priority when set.
#16819b5dd8f1 Thanks @astrobot-houston! - Fixes custom elements in MDX files bypassing the renderer pipeline. Custom elements (tags containing hyphens like <my-element>) in .mdx files are now routed through registered renderers for SSR, matching the behavior of .astro files. If no renderer claims the element, it falls back to rendering as raw HTML.
#16808765896c Thanks @ematipico! - Fixes dynamic routes returning 400 Bad Request when the URL contains a literal % character, such as paths built with encodeURIComponent('%?.pdf')
#1680490d2aca Thanks @jp-knj! - Fixes a v6 regression where astro:i18n could not be imported from client <script> blocks.
#167748f77583 Thanks @astrobot-houston! - Fixes markdown images with empty alt text () in content collections dropping the alt attribute entirely. The alt="" attribute is now correctly preserved in the rendered HTML output, which is important for accessibility (indicating decorative images).
#167763d10b5e Thanks @matthewp! - Fixes HMR serving stale content when components are passed as props via getStaticPaths()
#167847453860 Thanks @ematipico! - Improved the printing of the build time if it goes over the 60 seconds.
#166653dbbcee Thanks @Princesseuh! - Fixes remote SVG sources erroring with dangerouslyProcessSVG after the v6.3 SVG-processing gate. The default Sharp service now resolves the output format from the source up-front when it can (URL extension, data: MIME, ESM metadata), and from the actual buffer at request time when it can’t, so SVG sources pass through untouched without needing to set image.dangerouslyProcessSVG: true or an explicit format="svg".
The error message has also been updated to point at format="svg" as the simpler workaround when an SVG source is encountered without dangerouslyProcessSVG enabled.
#167771754b91 Thanks @matthewp! - Fixes HMR serving stale content for dynamically imported components through barrel files
#16730068d924 Thanks @harshagarwalnyu! - Fixes an issue where the file() content loader did not generate a valid JSON Schema for collections whose JSON or YAML data is a top-level array instead of an object.
#167575d661cd Thanks @astrobot-houston! - Fixes dev server serving stale content when SSR-only modules change (e.g. .astro files outside the project root in a monorepo, or dynamically imported components).
Previously, the astro:hmr-reload plugin returned an empty array after detecting SSR-only module changes, which prevented Vite’s updateModules from propagating the invalidation to the SSR module runner. The runner’s evaluated module cache stayed stale, so subsequent requests continued returning old content.
Now the plugin returns the SSR-only modules so Vite can process them through updateModules, which properly invalidates the module runner’s cache and ensures fresh content on the next request.
#167230f10bfe Thanks @matthewp! - Adds fetchFile option to experimental.advancedRouting to customize or disable the entrypoint file
exportdefaultdefineConfig({
experimental: {
advancedRouting: {
fetchFile: 'fetch.ts',
},
},
});
#167230f10bfe Thanks @matthewp! - Fixes Hono cache() middleware to follow the standard wrapper pattern
#167230f10bfe Thanks @matthewp! - Adds App.Providers interface for typing custom context providers on Astro and ctx
declarenamespaceApp {
interfaceProviders {
oauth:import('./lib/oauth').OAuthSession;
}
}
#167230f10bfe Thanks @matthewp! - Adds FetchState.response property, set automatically after pages() or middleware() completes
constresponse=awaitmiddleware(state, (s) =>pages(s));
console.log(state.response === response); // true
#167230f10bfe Thanks @matthewp! - Adds Fetchable type export for typing the advanced routing entrypoint
importtype { Fetchable } from'astro';
exportdefault {
asyncfetch(request) {
returnnewResponse('ok');
},
} satisfiesFetchable;
#165724a5a077 Thanks @DORI2001! - Suppresses [WARN] Vite warning: unused imports from "@astrojs/internal-helpers/remote" during prerender builds. The package is now bundled alongside astro in the prerender environment, matching how it is handled in the SSR environment.
#16756b6ee23d Thanks @astrobot-houston! - Fixes styles from Markdoc/MDX custom components not being extracted to <head> in the dev server when using the Cloudflare adapter with prerenderEnvironment: 'node' and rendering content through a wrapper component.
#16747904d19a Thanks @astrobot-houston! - Fixes Astro action requests failing in astro dev when using the Cloudflare adapter with prerenderEnvironment: 'node' alongside a prerendered catch-all route such as [...page].astro.
Actions and other SSR POST endpoints now continue to work in dev instead of returning an HTTP 500 error.
#167013495ce4 Thanks @demaisj! - Fix Map and Set instances saved in a content collection being broken when retrieving entries.
#16614fca1c32 Thanks @Eptagone! - Fixes entry.data type inference when a live collection is configured without a schema.
#1666103b8f7f Thanks @ocavue! - Updates typescript to v6. No changes are needed from users.
#16681c22770a Thanks @dotnetCarpenter! - Fixes an issue where SVG images with width="0" or height="0" incorrectly threw a NoImageMetadata error instead of being treated as valid dimensions.
#1667511d4592 Thanks @ascorbic! - Fixes a regression where Astro.cache was undefined when experimental.cache was not configured.
The previous documented behavior is for Astro.cache to always be defined as a no-op shim: cache.set() warns once, cache.invalidate() throws and cache.enabled can be used to gate. This allows library and user code can call cache methods without conditional checks. The cache provider registration was being gated at the call site on experimental.cache being configured, which meant the disabled shim branch inside the provider was unreachable and the Astro.cache getter was never attached to the context.
#166910f0a4ce Thanks @matthewp! - Fixes HTMLElement is not defined error during HMR when using components with client-side scripts (e.g. Starlight <Tabs>) and the Cloudflare adapter
#1656207529ec Thanks @matthewp! - Fixes non-prerendered routes failing when a dynamic prerendered route exists in the same project with prerenderEnvironment: 'node'
#16638272185b Thanks @ematipico! - Fixes a bug where the Astro compiler wasn’t freed at the end of the build. After the fix, the memory used by the compiler is now correctly freed at the end of the build.
#16544d365c97 Thanks @matthewp! - Tightens isRemotePath() to reject control characters after a leading slash and fixes the dev image endpoint origin check
#16685889e748 Thanks @farrosfr! - Improve validation messages for security.csp.directives when script-src or style-src are incorrectly placed in the directives array.
#16605772f13a Thanks @rururux! - Fixes assetsPrefix not being available on build from astro:config/server.
#16556f38dec7 Thanks @matthewp! - Rejects double-encoded URL paths with a 400 response instead of silently falling back to partial decoding
#1665938bcb25 Thanks @jsparkdev! - Fixes & characters appearing as raw entity strings (e.g. &) in <meta> tags when viewed in link previews or raw HTML.
#16366d69f858 Thanks @matthewp! - Adds a new experimental.advancedRouting option that lets you take full control of Astro’s request handling pipeline by creating a src/app.ts file in your project.
Today, Astro handles every incoming request through a fixed internal pipeline: trailing slash normalization, redirects, actions, middleware, page rendering, i18n, and so on. That pipeline works great for most sites, but as projects grow you often want to run your own logic between those steps — an auth check before rendering, a rate limiter before actions, custom logging around the whole stack. Advanced routing gives you that control.
When enabled, Astro looks for a src/app.ts file in your project. If it finds one, that file becomes the entrypoint for all server-rendered requests. You compose the pipeline yourself using the handlers Astro provides, and you can slot your own logic anywhere in the chain.
Enabling advanced routing
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
advancedRouting: true,
},
});
Two ways to build your pipeline
Astro ships two entrypoints for advanced routing: astro/fetch and astro/hono.
astro/fetch is a low-level, framework-free API built on the Web Fetch standard. You create a FetchState from the incoming request, then call handler functions in sequence. Each handler takes the state, does its work, and returns a Response (or undefined to pass through). This is the core primitive that everything else is built on:
src/app.ts
import {
FetchState,
trailingSlash,
redirects,
actions,
middleware,
pages,
i18n,
} from'astro/fetch';
exportdefault {
asyncfetch(request:Request) {
conststate=newFetchState(request);
// Early exits — these return a Response only when they apply.
constslash=trailingSlash(state);
if (slash) return slash;
constredirect=redirects(state);
if (redirect) return redirect;
constaction=awaitactions(state);
if (action) return action;
// Middleware wraps page rendering; i18n post-processes the response.
astro/hono wraps the same handlers as Hono middleware, so you can mix Astro’s pipeline with Hono’s ecosystem of middleware (logger, CORS, JWT, rate limiting, etc.) using the app.use() pattern you already know:
Both approaches give you the same power — pick whichever fits your project. If you don’t need a framework, astro/fetch keeps things minimal. If you want a rich middleware ecosystem, astro/hono gets you there with one import.
For more information on enabling and using this feature in your project, see the experimental advanced routing docs. To give feedback, or to keep up with its development, see the advanced routing RFC for more information and discussion.
#16366d69f858 Thanks @matthewp! - Adds a consume() instance method to AstroCookies. This method marks the cookies as consumed and returns the Set-Cookie header values. After consumption, any subsequent set() calls will log a warning, since the headers have already been sent.
Previously this was only available as a static method AstroCookies.consume(cookies). The static method is now deprecated but kept for backward compatibility with existing adapters.
#16412ba2d2e3 Thanks @0xbejaxer! - Add retry and error event handling for astro-island hydration import failures to reduce unrecoverable hydration errors on transient network failures.
#16582885cd31 Thanks @Princesseuh! - Adds a new image.dangerouslyProcessSVG flag to optionally enable processing SVG inputs. For security reasons, Astro will no longer rasterizes SVG image sources by default in its default image service and endpoint.
Set image.dangerouslyProcessSVG: true to opt back into processing SVG inputs.
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
// ...
image: {
dangerouslyProcessSVG: true,
},
});
Note that this is a breaking change for users who were previously relying on Astro’s default image service to rasterize SVG inputs, but it is a necessary change to improve security and prevent potential vulnerabilities.
#165191b1c218 Thanks @louisescher! - Adds support for redirecting URLs in remote image optimization.
Previously, when a remote image URL meant to be optimized by Astro led to a redirect, Astro would fail silently and ignore the redirect. Now, Astro tracks up to 10 redirects for these images. If any of the redirects are not covered by a pattern in image.remotePatterns or a domain in image.domains, Astro will fail with a helpful error message.
In the following example, the first image would be loaded successfully, while the second would lead to Astro throwing an error:
exportdefaultdefineConfig({
image: {
domains: ['example.com', 'cdn.example.com'],
},
});
{
/* Redirects to https://cdn.example.com/assets/image.png: */
}
<Image
src="https://example.com/assets/image.png"
width="1920"
height="1080"
alt="An example image."
/>;
{
/* Redirects to https://malicious.com/image.png: */
}
<Image
src="https://example.com/bad-image.png"
width="1920"
height="1080"
alt="An example image."
/>;
In cases where all redirects to HTTPS hosts should be trusted, the following configuration for image.remotePatterns can be used:
exportdefaultdefineConfig({
image: {
remotePatterns: [
{
protocol: 'https',
},
],
},
});
🐞 Patch Changes
#165929c6efc5 Thanks @matthewp! - Escapes interpolated values in the dev server redirect HTML template, consistent with how the 404 template already handles them
#1658578f305e Thanks @web-dev0521! - Fixes z.array(z.boolean()) in form actions incorrectly coercing the string "false" to true. Boolean array elements now use the same 'true'/'false' string comparison as single z.boolean() fields, so submitting ["false", "true", "false"] correctly parses as [false, true, false].
#1656712a03f2 Thanks @matthewp! - Fixes deleted content collection entries persisting in getCollection() results during dev
#16595ce9b25c Thanks @web-dev0521! - Fixes pushDirective in the CSP runtime duplicating the new directive once per existing non-matching directive. Calling insertDirective() (or otherwise pushing a directive whose name is not yet in the list) now appends it exactly once, and a directive that merges with a later existing entry no longer leaves an unmerged copy behind.
#1660094e4b7c Thanks @web-dev0521! - Fixes Astro.preferredLocale returning the wrong value when i18n.locales mixes object-form entries ({ path, codes }) with string entries that normalize to the same locale. The first matching code in the configured locales order is now selected, matching the documented behavior.
#16591cce20f7 Thanks @matthewp! - Uses a consistent generic error message in the image endpoint across all adapters
#16629f54be80 Thanks @g-taki! - Fixes a bug where SSR responses in astro dev could crash with TypeError: this.logger.flush is not a function.
#165893740b24 Thanks @ArmandPhilippot! - Fixes an outdated code snippet in the documentation for session storage configuration.
#1629200f48ee Thanks @p-linnane! - Fixes head metadata propagation in dev for adapters that load modules in the prerender Vite environment, such as @astrojs/cloudflare. The astro:head-metadata plugin previously only tracked the ssr environment, so maybeRenderHead() could fire inside an unrelated component’s <template> element, trapping subsequent hoisted <style> blocks.
#16451778865f Thanks @maximslo! - Fixes build crash when processing animated AVIF images. Sharp now gracefully passes through unsupported image formats instead of crashing during the build.
#165487214d3e Thanks @senutpal! - Fixes scoped styles applying to the wrong element when vite.css.transformer is set to 'lightningcss' and a selector uses a nested & inside :where(...), such as Tailwind v4’s space-x-*, space-y-*, and divide-* utilities.
#165669ac96b4 Thanks @web-dev0521! - Fixes data-astro-prefetch="tap" not triggering when clicking nested elements (e.g. <span>, <img>, <svg>) inside an anchor tag.
#159941e70d18 Thanks @ossaidqadri! - Fix <style> compilation failure when importing Astro components via tsconfig path aliases
#161441cd6650 Thanks @fkatsuhiro! - Fixed a regression where .html was unexpectedly stripped from dynamic route parameters on non-page routes (.ts endpoints and redirects). This caused endpoints like /some/[...id].ts returning id: 'file.html' on getStaticPaths to not serve that file because the generated route (/some/file.html) would get matched as id: file that is not part of the list returned by getStaticPaths.
#16415559c0fd Thanks @0xbejaxer! - Fix CSS traversal boundaries so pages with export const partial = true still contribute styles when imported as components by other pages.
#1651617f1867 Thanks @fkatsuhiro! - Fixes an issue where the index route would return a 404 error when using a custom base path combined with trailingSlash: 'never'. This ensures that the home page and internal rewrites are correctly matched under these configurations.
#16515280ec88 Thanks @jp-knj! - Fixes an issue where i18n.fallback pages with fallbackType: 'rewrite' were emitted with empty bodies during astro build.
#165657959798 Thanks @enjoyandlove! - Fixes session persistence when session.delete() is the first mutation in a request (no prior get, set, has, or keys). The session was marked dirty in memory, but persistence skipped the save because #data stayed undefined, so the backing store could still return the deleted key on the next request.
#1652786fd80d Thanks @enjoyandlove! - Prevents script deduplication state from being consumed while rendering inert <template> contexts.
#16540e59c637 Thanks @ascorbic! - Skips session storage reads when no session cookie is present. Previously, calling session.get() on a request without a session cookie would initialize the storage driver and make a read that was guaranteed to miss. On network-backed drivers this added latency and resource usage to every anonymous request.
#165176ab0b3c Thanks @adamchal! - Removes inline CSS for prerendered routes from the SSR manifest. The static HTML on disk already inlines those styles, and the SSR worker never renders prerendered routes, so the data was dead weight. Builds with many prerendered routes and build.inlineStylesheets: "always" (or "auto" with small stylesheets) will see a smaller SSR entry chunk, which reduces cold-start parse time on platforms like Cloudflare Workers.
#16509d3d3557 Thanks @cyphercodes! - Fix conditional named slot callbacks receiving arguments from Astro.slots.render().
#16236c6b068e Thanks @fkatsuhiro! - Fixes the position prop on <Image /> and <Picture /> components to correctly apply object-position styles
#16018d14f47c Thanks @felmonon! - Fix defineLiveCollection() so LiveLoader data types declared as interfaces are accepted.
#1653176db01d Thanks @rodrigosdev! - Fixes config validation for omitted integrations fields with newer Zod versions.
#165357df0fe4 Thanks @rururux! - Fixed an issue where a warning was displayed when the server property was missing during config validation, even though it is not required.
#165345cf6c51 Thanks @matthewp! - Fixes compatibility with Zod 4.4.0 for the server config property and error formatting
The Rust-based Astro compiler (@astrojs/compiler-rs) is now the default compiler. This new compiler is faster and more reliable, leading to faster build times and iteration cycles during development.
This new compiler is more strict regarding invalid syntax. For example, unclosed HTML tags will now throw an error instead of being ignored. It also does not attempt to correct semantically invalid HTML anymore, instead leaving it to the browser to handle, similar to other tools or document.write() in JavaScript.
The previous Go-based compiler has been removed, along with the experimental.rustCompiler flag used to opt into the Rust compiler. If you were setting experimental.rustCompiler in your astro.config.mjs, you can now remove it. No other action is required.
🐞 Patch Changes
#15819cafec4e Thanks @delucis! - Fixes --port flag being ignored after a Vite-triggered server restart (e.g. when a .env file changes)
#16434ee079d4 Thanks @ematipico! - Fixes an issue where i18n domains would return 404 when trailingSlash is set to never.
#16187fe58071 Thanks @gllmt! - Adds a waitUntil option to the RenderOptions so that adapters can forward runtime background-task hooks to Astro.
When provided by an adapter, runtime cache providers receive context.waitUntil in
CacheProvider.onRequest(), which allows background cache work such as stale-while-revalidate
without blocking the response. The Cloudflare adapter now forwards
ExecutionContext.waitUntil to this API.
#16290a49637a Thanks @ViVaLaDaniel! - Ensures that server.allowedHosts (and vite.preview.allowedHosts) configuration is respected when using astro preview with the @astrojs/cloudflare adapter. This improves security by preventing DNS rebinding attacks when previewing Cloudflare builds locally.
#157254108ec1 Thanks @meyer! - Adds support for a new 'jsx' value for the compressHTML option. When set, whitespace is stripped using JSX whitespace rules instead of the default HTML compression strategy.
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
compressHTML: 'jsx',
});
In JSX, whitespaces never matter, as such, no amount of indentation, or newlines will not affect the rendered output. For instance, the following code:
<div>
<span>foo</span>
<span>bar</span>
</div>
will be rendered as foobar, whereas with HTML whitespace rules, a space would be present between the words due to the newline and indentation between the tags.
This experimental feature provides better control over Astro’s logging infrastructure by allowing users to replace the default console output with custom logging implementations (e.g., structured JSON). This is particularly useful for users using on-demand rendering and wishing to connect their log aggregation services, such as Kibana, Logstash, CloudWatch, Grafana, or Loki.
By default, Astro provides three built-in log handlers (json, node, and console), but you can also create your own.
JSON logging
JSON logging can be enabled via the CLI for the build, dev, and sync commands using the experimentalJson flag:
For more information on enabling and using this feature in your project, see the Experimental Logger docs.
For a complete overview and to give feedback on this experimental API, see the Custom logger RFC.
#163330f7c3c8 Thanks @florian-lefebvre! - Adds an experimental flag svgOptimizer that enables automatic optimization of your SVG components using the provided optimizer. This supersedes the svgo experimental flag, which is now removed.
When enabled, your imported SVG files used as components will be optimized for smaller file sizes and better performance while maintaining visual quality. This can significantly reduce the size of your SVG assets by removing unnecessary metadata, comments, and redundant code.
Astro ships with a SVGO based optimizer, but any can be used.
To enable this feature, add the experimental flag in your Astro config and remove svgo if it was enabled:
astro.config.mjs
import { defineConfig } from "astro/config";
import { defineConfig, svgoOptimizer } from "astro/config";
#16302f6f8e80 Thanks @florian-lefebvre! - Adds a new experimental_getFontFileURL() method to resolve font file URLs when using the Fonts API
The fontData object exported from astro:assets was introduced to provide low-level access to font family data for advanced usage. One of the goals of this API was to be able to resolve buffers using URLs. However, it turned out to be impractical, especially during prerendering.
Astro now exports a new experimental_getFontFileURL() helper function from astro:assets to resolve font file URLs from fontData. For example, when using satori to generate Open Graph images:
src/pages/og.png.ts
import type { APIRoute } from "astro";
import { fontData } from "astro:assets";
import { fontData, experimental_getFontFileURL } from "astro:assets";
#164791058428 Thanks @matthewp! - Fixes a spurious [WARN] [content] Content config not loaded warning during astro dev for projects that don’t use content collections
#164573d82220 Thanks @matthewp! - Hardens server island encryption to prevent encrypted data from one island component being replayed against a different one
#16481152700e Thanks @matthewp! - Fixes a spurious 404 request for a dev toolbar sourcemap during astro dev caused by the browser mis-resolving a relative sourceMappingURL from the /@id/ URL prefix
#164801bcb43b Thanks @matthewp! - Fixes an unnecessary full page reload on first navigation during dev
#1644899464ed Thanks @matthewp! - Updates vite, picomatch, and unstorage to latest patch versions
#16422a3951d7 Thanks @matthewp! - Hardens astro-island export resolution and hydration error handling for malformed component metadata
#16420e21de1d Thanks @matthewp! - Hardens Astro’s error overlay and server logging paths to avoid unsafe HTML insertion and format-string interpolation
#16419f3485c3 Thanks @matthewp! - Hardens nested object and package metadata lookups to ignore prototype keys in content handling and project scaffolding
#16022a002540 Thanks @mathieumaf! - Fixes an issue where i18n domains would return 404 when trailingSlash is set to never.
#16367a6866a7 Thanks @ematipico! - Fixes an issue where build output files could contain special characters (!, ~, {, }) in their names, causing deploy failures on platforms like Netlify.
#16381217c5b3 Thanks @ematipico! - Slightly improved the performance of the dev server by caching the internal crawling of the dependencies of a project.
#163487d26cd7 Thanks @ocavue! - Fixes a bug where emitted assets during a client build would contain always fresh, new hashes in their name. Now the build should be more stable.
#16317d012bfe Thanks @das-peter! - Fixes a bug where allowedDomains weren’t correctly propagated when using the development server.
#163795a84551 Thanks @martrapp! - Improves Vue scoped style handling in DEV mode during client router navigation.
#16317d012bfe Thanks @das-peter! - Adds tests to verify settings are properly propagated when using the development server.
#162825b0fdaa Thanks @jmurty! - Fixes build errors on platforms with skew protection enabled (e.g. Vercel, Netlify) for inter-chunk Javascript using dynamic imports
#16027c62516b Thanks @fkatsuhiro! - Fixes a bug where remote image dimensions were not validated during static builds on Netlify.
#1631194048f2 Thanks @Arecsu! - Fixes --port flag being ignored after a Vite-triggered server restart (e.g. when a .env file changes)
#163160fcd04c Thanks @ematipico! - Fixes the /_image endpoint accepting an arbitrary f=svg query parameter and serving non-SVG content as image/svg+xml. The endpoint now validates that the source is actually SVG before honoring f=svg, matching the same guard already enforced on the <Image> component path.
#16202b5c2fba Thanks @matthewp! - Fixes Actions failing with ActionsWithoutServerOutputError when using output: 'static' with an adapter
#16303b06eabf Thanks @matthewp! - Improves handling of special characters in inline <script> content
#14924bb4586a Thanks @aralroca! - Fixes SCSS and CSS module file changes triggering a full page reload instead of hot-updating styles in place during development
#161715bcd03c Thanks @Desel72! - Fixes a build error that occurred when a pre-rendered page used the <Picture> component and another page called render() on content collection entries.
#162397c65c04 Thanks @dataCenter430! - Fixes sync content inside <Fragment> not streaming to the browser until all async sibling expressions have resolved.
#16242686c312 Thanks @martrapp! - Revives UnoCSS in dev mode when used with the client router.
This change partly reverts #16089, which in hindsight turned out to be too general. Instead of automatically persisting all style sheets, we now do this only for styles from Vue components.
When creating new projects, astro add cloudflare now sets compatibility_date to the current date. Previously, this date was resolved from locally installed packages, which could be unreliable in some package manager environments. Using today’s date is simpler and more reliable across environments, and is supported by workerd.
#1619721f9fe2 Thanks @SchahinRohani! - Remove unused re-exports from assets/utils barrel file to fix Vite build warning
#160596d5469e Thanks @matthewp! - Fixes Expected 'miniflare' to be defined errors and 404 responses in dev mode when using the Cloudflare adapter and the config file changes. Instead of creating a brand new Vite server on config changes, Astro now performs a Vite in-place restart, allowing the Cloudflare adapter to reuse its existing miniflare instance across restarts.
#161547610ba4 Thanks @Desel72! - Fixes pages with dots in their filenames (e.g. hello.world.astro) returning 404 when accessed with a trailing slash in the dev server. The trailingSlashForPath function now only forces trailingSlash: 'never' for endpoints with file extensions, allowing pages to correctly respect the user’s trailingSlash config.
#1619323425e2 Thanks @matthewp! - Fixes trailingSlash: "always" producing redirect HTML instead of the actual response for extensionless endpoints during static builds
#16161b51f297 Thanks @matthewp! - Fixes a dev rendering issue with the Cloudflare adapter where head metadata could be missing and dev CSS/scripts could be injected in the wrong place
#16110de669f0 Thanks @tmimmanuel! - Fixes skew protection query parameters not being appended to inter-chunk JavaScript imports in client bundles, which could cause version mismatches during rolling deployments on Vercel
#16162a0a49e9 Thanks @rururux! - Fixes an issue where HMR would not trigger when modifying files while using @astrojs/cloudflare with prerenderEnvironment: ‘node’ enabled.
#161427454854 Thanks @rururux! - Fixes HTML content being incorrectly escaped as plain text when rendering a MDX component using the AstroContainer APIs.
#1611612602a9 Thanks @riderx! - Fixes a bug where page-level CSS could leak between unrelated pages when traversing style parents across top-level route boundaries
#16178a7e7567 Thanks @matthewp! - Fixes SSR builds failing with “No matching renderer found” when a project only has injected routes and no src/pages/ directory
#1610447a394d Thanks @matthewp! - Fixes astro preview ignoring vite.preview.allowedHosts set in astro.config.mjs
#16047711f837 Thanks @matthewp! - Fixes catch-all routes incorrectly intercepting requests for static assets when using the @astrojs/node adapter in middleware mode.
#15981a60cbb6 Thanks @moktamd! - Fix Zod v4 validation error formatting to show human-readable messages instead of raw JSON
#15804a5e7232 Thanks @merlinnot! - Allows setting codec-specific defaults for Astro’s built-in Sharp image service via image.service.config.
You can now configure encoder-level options such as jpeg.mozjpeg, webp.effort, webp.alphaQuality, avif.effort, avif.chromaSubsampling, and png.compressionLevel when using astro/assets/services/sharp for compile-time image generation.
These settings apply as defaults for the built-in Sharp pipeline, while per-image quality still takes precedence when set on <Image />, <Picture />, or getImage().
#15455babf57f Thanks @AhmadYasser1! - Adds fallbackRoutes to the IntegrationResolvedRoute type, exposing i18n fallback routes to integrations via the astro:routes:resolved hook for projects using fallbackType: 'rewrite'.
This allows integrations such as the sitemap integration to properly include generated fallback routes in their output.
You can now pass an options object to markdown.smartypants in your Astro configuration to fine-tune how punctuation, dashes, and quotes are transformed.
This is helpful for projects that require specific typographic standards, such as “oldschool” dash handling or localized quotation marks.
#16025a09f319 Thanks @koji-1009! - Instructs the client router to skip view transition animations when the browser is already providing its own visual transition, such as a swipe gesture.
#16055ccecb8f Thanks @Gautam-Bharadwaj! - Fixes an issue where client:only components could have duplicate client:component-path attributes added in MDX in rare cases
#1608144fc340 Thanks @crazylogic03! - Fixes the emitFile() is not supported in serve mode warning that appears during astro dev when using integrations that inject before-hydration scripts (e.g. @astrojs/react)
#1606831d733b Thanks @Karthikeya1500! - Fixes the dev toolbar a11y audit incorrectly classifying menuitemradio as a non-interactive ARIA role.
#16080e80ac73 Thanks @ematipico! - Fixes experimental.queuedRendering incorrectly escaping the HTML output of .html page files, causing the page content to render as plain text instead of HTML in the browser.
#1604813b9d56 Thanks @matthewp! - Fixes a dev server crash (serverIslandNameMap.get is not a function) that occurred when navigating to a page with server:defer after first visiting a page without one, when using @astrojs/cloudflare
#16093336e086 Thanks @Snugug! - Fixes Zod meta not correctly being rendered on top-level schema when converted into JSON Schema
#16043d402485 Thanks @ematipico! - Fixes checkOrigin CSRF protection in astro dev behind a TLS-terminating reverse proxy. The dev server now reads X-Forwarded-Proto (gated on security.allowedDomains, matching production behaviour) so the constructed request origin matches the https:// origin the browser sends. Also ensures security.allowedDomains and security.checkOrigin are respected in dev.
#16064ba58e0d Thanks @ematipico! - Updates the dependency svgo to the latest, to fix a security issue.
#160072dcd8d5 Thanks @florian-lefebvre! - Fixes a case where fonts files would unecessarily be copied several times during the build
#16017b089b90 Thanks @felmonon! - Fix the astro sync error message when getImage() is called while loading content collections.
#16014fa73fbb Thanks @matthewp! - Fixes a build error where using astro:config/client inside a <script> tag would cause Rollup to fail with “failed to resolve import virtual:astro:routes from virtual:astro:manifest”
#16054f74465a Thanks @seroperson! - Fixes an issue with the development server, where changes to the middleware weren’t picked, and it required a full restart of the server.
#16033198d31b Thanks @adampage! - Fixes a bug where the the role image was incorrectly reported by audit tool bar.
#15935278828c Thanks @oliverlynch! - Fixes cached assets failing to revalidate due to redirect check mishandling Not Modified responses.
#160752c1ae85 Thanks @florian-lefebvre! - Fixes a case where invalid URLs would be generated in development when using font families with an oblique style and angles
#1606287fd6a4 Thanks @matthewp! - Warns on dev server startup when Vite 8 is detected at the top level of the user’s project, and automatically adds a "overrides": { "vite": "^7" } entry to package.json when running astro add cloudflare. This prevents a require_dist is not a function crash caused by a Vite version split between Astro (requires Vite 7) and packages like @tailwindcss/vite that hoist Vite 8.
#159786d182fe Thanks @seroperson! - Fixes a bug where Astro Actions didn’t properly support nested object properties, causing problems when users used zod functions such as superRefine or discriminatedUnion.
#16011e752170 Thanks @matthewp! - Fixes a dev server hang on the first request when using the Cloudflare adapter
#159971fddff7 Thanks @ematipico! - Fixes Astro.rewrite() failing when the target path contains duplicate slashes (e.g. //about). The duplicate slashes are now collapsed before URL parsing, preventing them from being interpreted as a protocol-relative URL.
#15950acce5e8 Thanks @matthewp! - Fixes a build regression in projects with multiple frontend integrations where server:defer server islands could fail at runtime when all pages are prerendered.
#15988c93b4a0 Thanks @ossaidqadri! - Fix styles from dynamically imported components not being injected on first dev server load.
#159683e7a9d5 Thanks @chasemccoy! - Fixes renderMarkdown in custom content loaders not resolving images in markdown content. Images referenced in markdown processed by renderMarkdown are now correctly optimized, matching the behavior of the built-in glob() loader.
#159901e6017f Thanks @ematipico! - Fixes an issue where Astro.currentLocale would always be the default locale instead of the actual one when using a dynamic route like [locale].astro or [locale]/index.astro. It now resolves to the correct locale from the URL.
#159901e6017f Thanks @ematipico! - Fixes an issue where visiting an invalid locale URL (e.g. /asdf/) would show the content of a dynamic [locale] page with a 404 status code, instead of showing your custom 404 page. Now, the correct 404 page is rendered when the locale in the URL doesn’t match any configured locale.
#159601d84020 Thanks @matthewp! - Fixes Cloudflare dev server islands with prerenderEnvironment: 'node' by sharing the serialized manifest encryption key across dev environments and routing server island requests through the SSR runtime.
#157359685e2d Thanks @fa-sharp! - Fixes an EventEmitter memory leak when serving static pages from Node.js middleware.
When using the middleware handler, requests that were being passed on to Express / Fastify (e.g. static files / pre-rendered pages / etc.) weren’t cleaning up socket listeners before calling next(), causing a memory leak warning. This fix makes sure to run the cleanup before calling next().
#159652dca307 Thanks @matthewp! - Fixes client hydration for components imported through Node.js subpath imports (package.json#imports, e.g. #components/*), for example when using the Cloudflare adapter in development.
#157706102ca2 Thanks @jpc-ae! - Updates the create astro welcome message to highlight the graceful dev/preview server quit command rather than the kill process shortcut
#159537eddf22 Thanks @Desel72! - fix(hmr): eagerly recompile on style-only change to prevent stale slots render
#159165201ed4 Thanks @trueberryless! - Fixes InferLoaderSchema type inference for content collections defined with a loader that includes a schema
#15864d3c7de9 Thanks @florian-lefebvre! - Removes temporary support for Node >=20.19.1 because Stackblitz now uses Node 22 by default
#15944a5e1acd Thanks @fkatsuhiro! - Fixes SSR dynamic routes with .html extension (e.g. [slug].html.astro) not working
#15937d236245 Thanks @ematipico! - Fixes an issue where HMR didn’t correctly work on Windows when adding/changing/deleting routes in pages/.
#1593198dfb61 Thanks @Strernd! - Fix skew protection query params not being applied to island hydration component-url and renderer-url, and ensure query params are appended safely for asset URLs with existing search/hash parts.
#15891b889231 Thanks @matthewp! - Fix dev routing for server:defer islands when adapters opt into handling prerendered routes in Astro core. Server island requests are now treated as prerender-handler eligible so prerendered pages using prerenderEnvironment: 'node' can load island content without 400 errors.
#15890765a887 Thanks @matthewp! - Fixes astro:actions validation to check resolved routes, so projects using default static output with at least one prerender = false page or endpoint no longer fail during startup.
#15884dcd2c8e Thanks @matthewp! - Avoid a MaxListenersExceededWarning during astro dev startup by increasing the shared Vite watcher listener limit when attaching content server listeners.
#1590423d5244 Thanks @jlukic! - Emit the before-hydration script chunk for the client Vite environment. The chunk was only emitted for prerender and ssr environments, causing a 404 when browsers tried to load it. This broke hydration for any integration using injectScript('before-hydration', ...), including Lit SSR.
#15933325901e Thanks @ematipico! - Fixes an issue where <style> tags inside SVG components weren’t correctly tracked when enabling CSP.
#15875c43ef8a Thanks @matthewp! - Ensure custom prerenderers are always torn down during build, even when getStaticPaths() throws.
#158871861fed Thanks @ematipico! - Fixes an issue where the build incorrectly leaked server entrypoint into the client environment, causing adapters to emit warnings during the build.
#15888925252e Thanks @matthewp! - Fix a bug where server:defer could fail at runtime in prerendered pages for some adapters (including Cloudflare), causing errors like serverIslandMap?.get is not a function.
#1590107c1002 Thanks @delucis! - Fixes JSON schema generation for content collection schemas that have differences between their input and output shapes.
#15882759f946 Thanks @matthewp! - Fix Astro.url.pathname for the root page when using build.format: "file" so it resolves to /index.html instead of /.html during builds.
#15870920f10b Thanks @matthewp! - Prebundle astro/toolbar in dev when custom dev toolbar apps are registered, preventing re-optimization reloads that can hide or break the toolbar.
#15876f47ac53 Thanks @ematipico! - Fixes redirectToDefaultLocale producing a protocol-relative URL (//locale) instead of an absolute path (/locale) when base is '/'.
#15767e0042f7 Thanks @matthewp! - Fixes server islands (server:defer) not working when only used in prerendered pages with output: 'server'.
#1587335841ed Thanks @matthewp! - Fix a dev server bug where newly created pages could miss layout-imported CSS until restart.
#1575458f1d63 Thanks @rururux! - Fixes a bug where a directory at the project root sharing the same name as a page route would cause the dev server to return a 404 instead of serving the page.
#1586976b3a5e Thanks @matthewp! - Update the unknown file extension error hint to recommend vite.resolve.noExternal, which is the correct Vite 7 config key.
#15711b2bd27b Thanks @OliverSpeir! - Improves Astro core’s dev environment handling for prerendered routes by ensuring route/CSS updates and prerender middleware behavior work correctly across both SSR and prerender environments.
This enables integrations that use Astro’s prerender dev environment (such as Cloudflare with prerenderEnvironment: 'node') to get consistent route matching and HMR behavior during development.
#158521cdaf9f Thanks @ematipico! - Fixes a regression where the the routes emitted by the astro:build:done hook didn’t have the distURL array correctly populated.
#15765ca76ff1 Thanks @matthewp! - Hardens server island POST endpoint validation to use own-property checks for improved consistency
#154619f21b24 Thanks @florian-lefebvre! - BREAKING CHANGE to the v6 beta Adapter API only: renames entryType to entrypointResolution and updates possible values
Astro 6 introduced a way to let adapters have more control over the entrypoint by passing entryType: 'self' to setAdapter(). However during beta development, the name was unclear and confusing.
entryType is now renamed to entrypointResolution and its possible values are updated:
legacy-dynamic becomes explicit.
self becomes auto.
If you are building an adapter with v6 beta and specifying entryType, update it:
#14759d7889f7 Thanks @florian-lefebvre! - Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent createSchema() property (Loader API) - (v6 upgrade guidance)
#153327c55f80 Thanks @matthewp! - Adds frontmatter parsing support to renderMarkdown in content loaders. When markdown content includes frontmatter, it is now extracted and available in metadata.frontmatter, and excluded from the HTML output. This makes renderMarkdown behave consistently with the glob loader.
constloader= {
name: 'my-loader',
load: async ({ store, renderMarkdown }) => {
constcontent=`---
title: My Post
---
# Hello World
`;
constrendered=awaitrenderMarkdown(content);
// rendered.metadata.frontmatter is now { title: 'My Post' }
// rendered.html contains only the content, not the frontmatter
#15266f7c9365 Thanks @florian-lefebvre! - Allows Astro.csp and context.csp to be undefined instead of throwing errors when csp: true is not configured
When using the experimental Content Security Policy feature in Astro 5.x, context.csp was always defined but would throw if experimental.csp was not enabled in the Astro config.
For the stable version of this API in Astro 6, context.csp can now be undefined if CSP is not enabled and its methods will never throw.
What should I do?
If you were using experimental CSP runtime utilities, you must now access methods conditionally:
#14306141c4a2 Thanks @ematipico! - Adds new optional properties to setAdapter() for adapter entrypoint handling in the Adapter API
Changes:
New optional properties:
entryType?: 'self' | 'legacy-dynamic' - determines if the adapter provides its own entrypoint ('self') or if Astro constructs one ('legacy-dynamic', default)
Migration: Adapter authors can optionally add these properties to support custom dev entrypoints. If not specified, adapters will use the legacy behavior.
#157004e7f3e8 Thanks @ocavue! - Updates the internal logic during SSR by providing additional metadata for UI framework integrations.
#152313928b87 Thanks @rururux! - Adds a new optional getRemoteSize() method to the Image Service API.
Previously, inferRemoteSize() had a fixed implementation that fetched the entire image to determine its dimensions.
With this new helper function that extends inferRemoteSize(), you can now override or extend how remote image metadata is retrieved.
This enables use cases such as:
Caching: Storing image dimensions in a database or local cache to avoid redundant network requests.
Provider APIs: Using a specific image provider’s API (like Cloudinary or Vercel) to get dimensions without downloading the file.
For example, you can add a simple cache layer to your existing image service:
#15077a164c77 Thanks @matthewp! - Updates the Integration API to add setPrerenderer() to the astro:build:start hook, allowing adapters to provide custom prerendering logic.
The new API accepts either an AstroPrerenderer object directly, or a factory function that receives the default prerenderer:
'astro:build:start': ({ setPrerenderer }) => {
setPrerenderer((defaultPrerenderer) => ({
name: 'my-prerenderer',
asyncsetup() {
// Optional: called once before prerendering starts
},
asyncgetStaticPaths() {
// Returns array of { pathname: string, route: RouteData }
return defaultPrerenderer.getStaticPaths();
},
asyncrender(request, { routeData }) {
// request: Request
// routeData: RouteData
// Returns: Response
},
asyncteardown() {
// Optional: called after all pages are prerendered
}
}));
}
Also adds the astro:static-paths virtual module, which exports a StaticPaths class for adapters to collect all prerenderable paths from within their target runtime. This is useful when implementing a custom prerenderer that runs in a non-Node environment:
// In your adapter's request handler (running in target runtime)
import { App } from'astro/app';
import { StaticPaths } from'astro:static-paths';
exportfunctioncreateApp(manifest) {
constapp=newApp(manifest);
return {
asyncfetch(request) {
const { pathname } =newURL(request.url);
// Expose endpoint for prerenderer to get static paths
if (pathname ==='/__astro_static_paths') {
conststaticPaths=newStaticPaths(app);
constpaths=await staticPaths.getAll();
returnnewResponse(JSON.stringify({ paths }));
}
// Normal request handling
return app.render(request);
},
};
}
See the adapter reference for more details on implementing a custom prerenderer.
#15345840fbf9 Thanks @matthewp! - Adds a new emitClientAsset function to astro/assets/utils for integration authors. This function allows emitting assets that will be moved to the client directory during SSR builds, useful for assets referenced in server-rendered content that need to be available on the client.
#15460ee7e53f Thanks @florian-lefebvre! - Updates the Adapter API to allow providing a serverEntrypoint when using entryType: 'self'
Astro 6 introduced a new powerful yet simple Adapter API for defining custom server entrypoints. You can now call setAdapter() with the entryType: 'self' option and specify your custom serverEntrypoint:
exportfunctionmyAdapter() {
return {
name: 'my-adapter',
hooks: {
'astro:config:done': ({ setAdapter }) => {
setAdapter({
name: 'my-adapter',
entryType: 'self',
serverEntrypoint: 'my-adapter/server.js',
supportedAstroFeatures: {
// ...
},
});
},
},
};
}
If you need further customization at the Vite level, you can omit serverEntrypoint and instead specify your custom server entrypoint with vite.build.rollupOptions.input.
#157812de969d Thanks @ematipico! - Adds a new clientAddress option to the createContext() function
Providing this value gives adapter and middleware authors explicit control over the client IP address. When not provided, accessing clientAddress throws an error consistent with other contexts where it is not set by the adapter.
Additionally, both of the official Netlify and Vercel adapters have been updated to provide this information in their edge middleware.
import { createContext } from'astro/middleware';
createContext({
clientAddress: context.headers.get('x-real-ip'),
});
#15258d339a18 Thanks @ematipico! - Stabilizes the adapter feature experimentalStatiHeaders. If you were using this feature in any of the supported adapters, you’ll need to change the name of the flag:
To replace the deprecated NodeApp.createRequest() and NodeApp.writeResponse() methods, the astro/app/node module now exposes new createRequest() and writeResponse() utilities. These can be used to convert a NodeJS IncomingMessage into a web-standard Request and stream a web-standard Response into a NodeJS ServerResponse:
#15755f9ee868 Thanks @matthewp! - Adds a new security.serverIslandBodySizeLimit configuration option
Server island POST endpoints now enforce a body size limit, similar to the existing security.actionBodySizeLimit for Actions. The new option defaults to 1048576 (1 MB) and can be configured independently.
Requests exceeding the limit are rejected with a 413 response. You can customize the limit in your Astro config:
exportdefaultdefineConfig({
security: {
serverIslandBodySizeLimit: 2097152, // 2 MB
},
});
#15529a509941 Thanks @florian-lefebvre! - Adds a new build-in font provider npm to access fonts installed as NPM packages
You can now add web fonts specified in your package.json through Astro’s type-safe Fonts API. The npm font provider allows you to add fonts either from locally installed packages in node_modules or from a CDN.
Set fontProviders.npm() as your fonts provider along with the required name and cssVariable values, and add options as needed:
#1547132b4302 Thanks @ematipico! - Adds a new experimental flag queuedRendering to enable a queue-based rendering engine
The new engine is based on a two-pass process, where the first pass
traverses the tree of components, emits an ordered queue, and then the queue is rendered.
The new engine does not use recursion, and comes with two customizable options.
Early benchmarks showed significant speed improvements and memory efficiency in big projects.
Queue-rendered based
The new engine can be enabled in your Astro config with experimental.queuedRendering.enabled set to true, and can be further customized with additional sub-features.
astro.config.mjs
exportdefaultdefineConfig({
experimental: {
queuedRendering: {
enabled: true,
},
},
});
Pooling
With the new engine enabled, you now have the option to have a pool of nodes that can be saved and reused across page rendering. Node pooling has no effect when rendering pages on demand (SSR) because these rendering requests don’t share memory. However, it can be very useful for performance when building static pages.
astro.config.mjs
exportdefaultdefineConfig({
experimental: {
queuedRendering: {
enabled: true,
poolSize: 2000, // store up to 2k nodes to be reused across renderers
},
},
});
Content caching
The new engine additionally unlocks a new contentCache option. This allows you to cache values of nodes during the rendering phase. This is currently a boolean feature with no further customization (e.g. size of cache) that uses sensible defaults for most large content collections:
When disabled, the pool engine won’t cache strings, but only types.
astro.config.mjs
exportdefaultdefineConfig({
experimental: {
queuedRendering: {
enabled: true,
contentCache: true, // enable re-use of node values
#148884cd3fe4 Thanks @OliverSpeir! - Updates astro add cloudflare to better setup types, by adding ./worker-configuration.d.ts to tsconfig includes and a generate-types script to package.json
#156460dd9d00 Thanks @delucis! - Removes redundant fetchpriority attributes from the output of Astro’s <Image> component
Previously, Astro would always include fetchpriority="auto" on images not using the priority attribute.
However, this is the default value, so specifying it is redundant. This change omits the attribute by default.
#154955b99e90 Thanks @leekeh! - Adds a new middlewareMode adapter feature to replace the previous edgeMiddleware option.
This feature only impacts adapter authors. If your adapter supports edgeMiddleware, you should upgrade to the new middlewareMode option to specify the middleware mode for your adapter as soon as possible. The edgeMiddleware feature is deprecated and will be removed in a future major release.
#1569466449c9 Thanks @matthewp! - Adds preserveBuildClientDir option to adapter features
Adapters can now opt in to preserving the client/server directory structure for static builds by setting preserveBuildClientDir: true in their adapter features. When enabled, static builds will output files to build.client instead of directly to outDir.
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.
my-adapter/index.js
exportdefaultfunctionmyAdapter() {
return {
name: 'my-adapter',
hooks: {
'astro:config:done': ({ setAdapter }) => {
setAdapter({
name: 'my-adapter',
adapterFeatures: {
buildOutput: 'static',
preserveBuildClientDir: true,
},
});
},
},
};
}
#153327c55f80 Thanks @matthewp! - Adds a fileURL option to renderMarkdown in content loaders, enabling resolution of relative image paths. When provided, relative image paths in markdown will be resolved relative to the specified file URL and included in metadata.localImagePaths.
constloader= {
name: 'my-loader',
load: async ({ store, renderMarkdown }) => {
constcontent=`
# My Post

`;
// Provide a fileURL to resolve relative image paths
// rendered.metadata.localImagePaths now contains the resolved image path
},
};
#15407aedbbd8 Thanks @ematipico! - Adds support for responsive images when security.csp is enabled, out of the box.
Astro’s implementation of responsive image styles has been updated to be compatible with a configured Content Security Policy.
Instead of, injecting style elements at runtime, Astro will now generate your styles at build time using a combination of class="" and data-* attributes. This means that your processed styles are loaded and hashed out of the box by Astro.
If you were previously choosing between Astro’s CSP feature and including responsive images on your site, you may now use them together.
#15543d43841d Thanks @Princesseuh! - Adds a new experimental.rustCompiler flag to opt into the experimental Rust-based Astro compiler
This experimental compiler is faster, provides better error messages, and generally has better support for modern JavaScript, TypeScript, and CSS features.
After enabling in your Astro config, the @astrojs/compiler-rs package must also be installed into your project separately:
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
rustCompiler: true,
},
});
This new compiler is still in early development and may exhibit some differences compared to the existing Go-based compiler. Notably, this compiler is generally more strict in regard to invalid HTML syntax and may throw errors in cases where the Go-based compiler would have been more lenient. For example, unclosed tags (e.g. <p>My paragraph) will now result in errors.
For more information about using this experimental feature in your project, especially regarding expected differences and limitations, please see the experimental Rust compiler reference docs. To give feedback on the compiler, or to keep up with its development, see the RFC for a new compiler for Astro for more information and discussion.
Live content collection loaders now receive the collection name as part of their parameters. This is helpful for loaders that manage multiple collections or need to differentiate behavior based on the collection being accessed.
For greater flexibility and improved consistency with other Astro code, session drivers are now specified as an object:
import { defineConfig } from 'astro/config'
import { defineConfig, sessionDrivers } from 'astro/config'
export default defineConfig({
session: {
driver: 'redis',
options: {
url: process.env.REDIS_URL
},
driver: sessionDrivers.redis({
url: process.env.REDIS_URL
}),
}
})
Specifying the session driver as a string has been deprecated, but will continue to work until this feature is removed completely in a future major version. The object shape is the current recommended and documented way to configure a session driver.
#1529189b6cdd Thanks @florian-lefebvre! - Adds a new Fonts API to provide first-party support for adding custom fonts in Astro.
This feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including preloading and fallback font generation.
To enable this feature, configure fonts with one or more fonts:
Import and include the <Font /> component with the required cssVariable property in the head of your page, usually in a dedicated Head.astro component or in a layout component directly:
src/layouts/Layout.astro
---
import { Font } from'astro:assets';
---
<html>
<head>
<FontcssVariable="--font-roboto"preload />
</head>
<body>
<slot />
</body>
</html>
In any page rendered with that layout, including the layout component itself, you can now define styles with your font’s cssVariable to apply your custom font.
In the following example, the <h1> heading will have the custom font applied, while the paragraph <p> will not.
src/pages/example.astro
---
import Layout from'../layouts/Layout.astro';
---
<Layout>
<h1>In a galaxy far, far away...</h1>
<p>Custom fonts make my headings much cooler!</p>
<style>
h1 {
font-family: var('--font-roboto');
}
</style>
</Layout>
Visit the updated fonts guide to learn more about adding custom fonts to your project.
Live content collections are a new type of content collection that fetch their data at runtime rather than build time. This allows you to access frequently updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes.
Live collections vs build-time collections
In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via getEntry() and getCollection(). The data is cached between builds, giving fast access and updates.
However, there was no method for updating the data store between builds, meaning any updates to the data needed a full site deploy, even if the pages are rendered on demand. This meant that content collections were not suitable for pages that update frequently. Instead, these pages tended to access the APIs directly in the frontmatter. This worked, but it led to a lot of boilerplate, and meant users didn’t benefit from the simple, unified API that content loaders offer. In most cases, users tended to individually create loader libraries shared between pages.
Live content collections (introduced experimentally in Astro 5.10) solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site.
How to use
To use live collections, create a new src/live.config.ts file (alongside your src/content.config.ts if you have one) to define your live collections with a live content loader using the new defineLiveCollection() function from the astro:content module:
You can then use the getLiveCollection() and getLiveEntry() functions to access your live data, along with error handling (since anything can happen when requesting live data!):
If you were using the experimental feature, you must remove the experimental.liveContentCollections flag from your astro.config.* file:
export default defineConfig({
// ...
experimental: {
liveContentCollections: true,
},
});
No other changes to your project code are required as long as you have been keeping up with Astro 5.x patch releases, which contained breaking changes to this experimental feature. If you experience problems with your live collections after upgrading to Astro v6 and removing this flag, please review the Astro CHANGELOG from 5.10.2 onwards for any potential updates you might have missed, or follow the current v6 documentation for live collections.
#155485b8f573 Thanks @florian-lefebvre! - Adds a new optional embeddedLangs prop to the <Code /> component to support languages beyond the primary lang
This allows, for example, highlighting .vue files with a <script setup lang="tsx"> block correctly:
---
import { Code } from'astro:components';
constcode=`
<script setup lang="tsx">
const Text = ({ text }: { text: string }) => <div>{text}</div>;
#14826170f64e Thanks @florian-lefebvre! - Adds an option prerenderConflictBehavior to configure the behavior of conflicting prerendered routes
By default, Astro warns you during the build about any conflicts between multiple dynamic routes that can result in the same output path. For example /blog/[slug] and /blog/[...all] both could try to prerender the /blog/post-1 path. In such cases, Astro renders only the highest priority route for the conflicting path. This allows your site to build successfully, although you may discover that some pages are rendered by unexpected routes.
With the new prerenderConflictBehavior configuration option, you can now configure this further:
prerenderConflictBehavior: 'error' fails the build
prerenderConflictBehavior: 'warn' (default) logs a warning and the highest-priority route wins
prerenderConflictBehavior: 'ignore' silently picks the highest-priority route when conflicts occur
#1557908437d5 Thanks @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 .astro pages) or context.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 using experimental.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.cache with a cache provider in your Astro config:
astro.config.mjs
import { defineConfig } from'astro/config';
import node from'@astrojs/node';
import { memoryCache } from'astro/config';
exportdefaultdefineConfig({
adapter: node({ mode: 'standalone' }),
experimental: {
cache: {
provider: memoryCache(),
},
},
});
Using Astro.cache and context.cache
In .astro pages, use Astro.cache.set() to control caching:
src/pages/index.astro
---
Astro.cache.set({
maxAge: 120, // Cache for 2 minutes
swr: 60, // Serve stale for 1 minute while revalidating
tags: ['home'], // Tag for targeted invalidation
});
---
<html><body>Cached page</body></html>
In API routes and middleware, use context.cache:
src/pages/api/data.ts
exportfunctionGET(context) {
context.cache.set({
maxAge: 300,
tags: ['api', 'data'],
});
return Response.json({ ok: true });
}
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 multiple set() calls within a request.
lastModified (Date): When multiple set() calls provide lastModified, 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, lastModified uses most-recent-wins, and tags accumulate.
Invalidation
Purge cached entries by tag or path using cache.invalidate():
Use experimental.routeRules to 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-route cache.set() calls merge with (and can override) the config-level defaults.
You can also read the current cache state via cache.options:
Cache behavior is determined by the configured cache provider. There are two types:
CDN providers set response headers (e.g. CDN-Cache-Control, Cache-Tag) and let the CDN handle caching. Astro strips these headers before sending the response to the client.
Runtime providers implement onRequest() to intercept and cache responses in-process, adding an X-Astro-Cache header (HIT/MISS/STALE) for observability.
Built-in memory cache provider
Astro includes a built-in, in-memory LRU runtime cache provider. Import memoryCache from astro/config to configure it.
Features:
In-memory LRU cache with configurable max entries (default: 1000)
Stale-while-revalidate support
Tag-based and path-based invalidation
X-Astro-Cache response header: HIT, MISS, or STALE
Query parameter sorting for better hit rates (?b=2&a=1 and ?a=1&b=2 hit the same entry)
Common tracking parameters (utm_*, fbclid, gclid, etc.) excluded from cache keys by default
Vary header support — responses that set Vary automatically get separate cache entries per variant
Configurable query parameter filtering via query.exclude (glob patterns) and query.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.
#154837be3308 Thanks @florian-lefebvre! - Adds streaming option to the createApp() function in the Adapter API, mirroring the same functionality available when creating a new App instance
An adapter’s createApp() function now accepts streaming (defaults to true) as an option. HTML streaming breaks a document into chunks to send over the network and render on the page in order. This normally results in visitors seeing your HTML as fast as possible but factors such as network conditions and waiting for data fetches can block page rendering.
HTML streaming helps with performance and generally provides a better visitor experience. In most cases, disabling streaming is not recommended.
However, when you need to disable HTML streaming (e.g. your host only supports non-streamed HTML caching at the CDN level), you can opt out of the default behavior by passing streaming: false to createApp():
#15423c5ea720 Thanks @matthewp! - Improves error message when a dynamic redirect destination does not match any existing route.
Previously, configuring a redirect like /categories/[category] → /categories/[category]/1 in static output mode would fail with a misleading “getStaticPaths required” error. Now, Astro detects this early and provides a clear error explaining that the destination does not match any existing route.
#151674fca170 Thanks @HiDeoo! - Fixes an issue where CSS from unused components, when using content collections, could be incorrectly included between page navigations in development mode.
#1556530cd6db Thanks @ematipico! - Fixes an issue where the use of the Astro internal logger couldn’t work with Cloudflare Vite plugin.
#155082c6484a Thanks @KTibow! - Fixes behavior when shortcuts are used before server is ready
#151256feb0d7 Thanks @florian-lefebvre! - Improves JSDoc annotations for AstroGlobal, AstroSharedContext and APIContext types
#157127ac43c7 Thanks @florian-lefebvre! - Improves astro info by supporting more operating systems when copying the information to the clipboard.
#1505422db567 Thanks @matthewp! - Improves zod union type error messages to show expected vs received types instead of generic “Invalid input”
#15064caf5621 Thanks @ascorbic! - Fixes a bug that caused incorrect warnings of duplicate entries to be logged by the glob loader when editing a file
#1580101db4f3 Thanks @ascorbic! - Improves the experience of working with experimental route caching in dev mode by replacing some errors with silent no-ops, avoiding the need to write conditional logic to handle different modes
Adds a cache.enabled property to CacheLike so libraries can check whether caching is active without try/catch.
#15573d789452 Thanks @matthewp! - Clear the route cache on content changes so slug pages reflect updated data during dev.
#1530889cbcfa Thanks @matthewp! - Fixes styles missing in dev for prerendered pages when using Cloudflare adapter
#15435957b9fe Thanks @rururux! - Improves compatibility of the built-in image endpoint with runtimes that don’t support CJS dependencies correctly
#156404c1a801 Thanks @ematipico! - Reverts the support of Shiki with CSP. Unfortunately, after exhaustive tests, the highlighter can’t be supported to cover all cases.
Adds a warning when both Content Security Policy (CSP) and Shiki syntax highlighting are enabled, as they are incompatible due to Shiki’s use of inline styles
#15415cc3c46c Thanks @ematipico! - Fixes an issue where CSP headers were incorrectly injected in the development server.
#1532218e0980 Thanks @matthewp! - Prevents missing CSS when using both SSR and prerendered routes
#15760f49a27f Thanks @ematipico! - Fixed an issue where queued rendering wasn’t correctly re-using the saved nodes.
#15277cb99214 Thanks @ematipico! - Fixes an issue where the function createShikiHighlighter would always create a new Shiki highlighter instance. Now the function returns a cached version of the highlighter based on the Shiki options. This should improve the performance for sites that heavily rely on Shiki and code in their pages.
#153945520f89 Thanks @florian-lefebvre! - Fixes a case where using the Fonts API with netlify dev wouldn’t work because of query parameters
#15605f6473fd Thanks @ascorbic! - Improves .astro component SSR rendering performance by up to 2x.
This includes several optimizations to the way that Astro generates and renders components on the server. These are mostly micro-optimizations, but they add up to a significant improvement in performance. Most pages will benefit, but pages with many components will see the biggest improvement, as will pages with lots of strings (e.g. text-heavy pages with lots of HTML elements).
#15721e6e146c Thanks @matthewp! - Fixes action route handling to return 404 for requests to prototype method names like constructor or toString used as action paths
#15497a93c81d Thanks @matthewp! - Fix dev reloads for content collection Markdown updates under Vite 7.
#15780e0ac125 Thanks @ematipico! - Prevents vite.envPrefix misconfiguration from exposing access: "secret" environment variables in client-side bundles. Astro now throws a clear error at startup if any vite.envPrefix entry matches a variable declared with access: "secret" in env.schema.
For example, the following configuration will throw an error for API_SECRET because it’s defined as secret its name matches ['PUBLIC_', 'API_'] defined in env.schema:
#15514999a7dd Thanks @veeceey! - Fixes font flash (FOUT) during ClientRouter navigation by preserving inline <style> elements and font preload links in the head during page transitions.
Previously, @font-face declarations from the <Font> component were removed and re-inserted on every client-side navigation, causing the browser to re-evaluate them.
#15560170ed89 Thanks @z0mt3c! - Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL.
The 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.
#156617150a2e Thanks @ematipico! - Fixes a build error when generating projects with 100k+ static routes.
#15580a92333c Thanks @ematipico! - Fixes a build error when generating projects with a large number of static routes
#151769265546 Thanks @matthewp! - Fixes hydration for framework components inside MDX when using Astro.slots.render()
Previously, when multiple framework components with client:* directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts.
#15506074901f Thanks @ascorbic! - Fixes a race condition where concurrent requests to dynamic routes in the dev server could produce incorrect params.
#1544410b0422 Thanks @AhmadYasser1! - Fixes Astro.rewrite returning 404 when rewriting to a URL with non-ASCII characters
When rewriting to a path containing non-ASCII characters (e.g., /redirected/héllo), the route lookup compared encoded distURL hrefs against decoded pathnames, causing the comparison to always fail and resulting in a 404. This fix compares against the encoded pathname instead.
#1572812ca621 Thanks @SvetimFM! - Improves internal state retention for persisted elements during view transitions, especially avoiding WebGL context loss in Safari and resets of CSS transitions and iframes in modern Chromium and Firefox browsers
#152798983f17 Thanks @ematipico! - Fixes an issue where the dev server would serve files like /README.md from the project root when they shouldn’t be accessible. A new route guard middleware now blocks direct URL access to files that exist outside of srcDir and publicDir, returning a 404 instead.
#15703829182b Thanks @matthewp! - Fixes server islands returning a 500 error in dev mode for adapters that do not set adapterFeatures.buildOutput (e.g. @astrojs/netlify)
#15749573d188 Thanks @ascorbic! - Fixes a bug that caused session.regenerate() to silently lose session data
Previously, regenerated session data was not saved under the new session ID unless set() was also called.
#15549be1c87e Thanks @0xRozier! - Fixes an issue where original (unoptimized) images from prerendered pages could be kept in the build output during SSR builds.
#15454b47a4e1 Thanks @Fryuni! - Fixes a race condition in the content layer which could result in dropped content collection entries.
#156851a323e5 Thanks @jcayzac! - Fix regression where SVG images in content collection image() fields could not be rendered as inline components. This behavior is now restored while preserving the TLA deadlock fix.
#156035bc2b2c Thanks @0xRozier! - Fixes a deadlock that occurred when using SVG images in content collections
Content collection loaders can now use await import() and import.meta.glob() to dynamically import modules during build. Previously, these would fail with “Vite module runner has been closed.”
#1556530cd6db Thanks @ematipico! - Fixes an issue where the use of the Code component would result in an unexpected error.
#153177e1e35a Thanks @matthewp! - Fixes ?raw imports failing when used in both SSR and prerendered routes
#1580994b4a46 Thanks @Princesseuh! - Fixes fit defaults not being applied unless layout was also specified
#15563e959698 Thanks @ematipico! - Fixes an issue where warnings would be logged during the build using one of the official adapters
#1512106261e0 Thanks @ematipico! - Fixes a bug where the Astro, with the Cloudflare integration, couldn’t correctly serve certain routes in the development server.
#1558598ea30c Thanks @matthewp! - Add a default body size limit for server actions to prevent oversized requests from exhausting memory.
#1526411efb05 Thanks @florian-lefebvre! - Lower the Node version requirement to allow running on Stackblitz until it supports v22
#157784ebc1e3 Thanks @ematipico! - Fixes an issue where the computed clientAddress was incorrect in cases of a Request header with multiple values. The clientAddress is now also validated to contain only characters valid in IP addresses, rejecting injection payloads.
#1556530cd6db Thanks @ematipico! - Fixes an issue where the new Astro v6 development server didn’t log anything when navigating the pages.
#1502422c48ba Thanks @florian-lefebvre! - Fixes a case where JSON schema generation would fail for unrepresentable types
This CommonJS dependency could sometimes cause errors because Astro is ESM-only. It is now replaced with a built-in ESM-friendly implementation.
#15740c5016fc Thanks @matthewp! - Removes an escape hatch that skipped attribute escaping for URL values containing &, ensuring all dynamic attribute values are consistently escaped
#15756b6c64d1 Thanks @matthewp! - Hardens the dev server by validating Sec-Fetch metadata headers to restrict cross-origin subresource requests
#15744fabb710 Thanks @matthewp! - Fixes cookie handling during error page rendering to ensure cookies set by middleware are consistently included in the response
#15776e9a9cc6 Thanks @matthewp! - Hardens error page response merging to ensure framing headers from the original response are not carried over to the rendered error page
#1575939ff2a5 Thanks @matthewp! - Adds a new bodySizeLimit option to the @astrojs/node adapter
You can now configure a maximum allowed request body size for your Node.js standalone server. The default limit is 1 GB. Set the value in bytes, or pass 0 to disable the limit entirely:
import node from'@astrojs/node';
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
adapter: node({
mode: 'standalone',
bodySizeLimit: 1024*1024*100, // 100 MB
}),
});
#1577702e24d9 Thanks @matthewp! - Fixes CSRF origin check mismatch by passing the actual server listening port to createRequest, ensuring the constructed URL origin includes the correct port (e.g., http://localhost:4321 instead of http://localhost). Also restricts X-Forwarded-Proto to only be trusted when allowedDomains is configured.
#157429d9699c Thanks @matthewp! - Hardens clientAddress resolution to respect security.allowedDomains for X-Forwarded-For, consistent with the existing handling of X-Forwarded-Host, X-Forwarded-Proto, and X-Forwarded-Port. The X-Forwarded-For header is now only used to determine Astro.clientAddress when the request’s host has been validated against an allowedDomains entry. Without a matching domain, clientAddress falls back to the socket’s remote address.
#157686328f1a Thanks @matthewp! - Hardens internal cookie parsing to use a null-prototype object consistently for the fallback path, aligning with how the cookie library handles parsed values
#151256feb0d7 Thanks @florian-lefebvre! - Fixes images not working in development when using setups with port forwarding
#158112ba0db5 Thanks @ematipico! - Fixes integration-injected scripts (e.g. Alpine.js via injectScript()) not being loaded in the dev server when using non-runnable environment adapters like @astrojs/cloudflare.
#152088dbdd8e Thanks @matthewp! - Makes session.driver optional in config schema, allowing adapters to provide default drivers
Adapters like Cloudflare, Netlify, and Node provide default session drivers, so users can now configure session options (like ttl) without explicitly specifying a driver.
#15260abca1eb Thanks @ematipico! - Fixes an issue where adding new pages weren’t correctly shown when using the development server.
#150938d5f783 Thanks @matthewp! - Reduces build memory by filtering routes per environment so each only builds the pages it needs
#1526854e5cc4 Thanks @rururux! - fix: avoid creating unused images during build in Picture component
#15757631aaed Thanks @matthewp! - Hardens URL pathname normalization to consistently handle backslash characters after decoding, ensuring middleware and router see the same canonical pathname
#153377ff7b11 Thanks @ematipico! - Fixes a bug where the development server couldn’t serve newly created new pages while the development server is running.
#157174000aaa Thanks @matthewp! - Ensures that URLs with multiple leading slashes (e.g. //admin) are normalized to a single slash before reaching middleware, so that pathname checks like context.url.pathname.startsWith('/admin') work consistently regardless of the request URL format
#1545050c9129 Thanks @florian-lefebvre! - Fixes a case where build.serverEntry would not be respected when using the new Adapter API
#153314592be5 Thanks @matthewp! - Fixes an issue where API routes would overwrite public files during build. Public files now correctly take priority over generated routes in both dev and build modes.
#15414faedcc4 Thanks @sapphi-red! - Fixes a bug where some requests to the dev server didn’t start with the leading /.
#15419a18d727 Thanks @ematipico! - Fixes an issue where the add command could accept any arbitrary value, leading the possible command injections. Now add and --add accepts
values that are only acceptable npmjs.org names.
#1550707f6610 Thanks @matthewp! - Avoid bundling SSR renderers when only API endpoints are dynamic
#15752918d394 Thanks @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.
#157433b4252a Thanks @matthewp! - Hardens config-based redirects with catch-all parameters to prevent producing protocol-relative URLs (e.g. //example.com) in the Location header
#157618939751 Thanks @ematipico! - Fixes an issue where it wasn’t possible to set experimental.queuedRendering.poolSize to 0.
#156339d293c2 Thanks @jwoyo! - Fixes a case where <script> tags from components passed as slots to server islands were not included in the response
#154916c60b05 Thanks @matthewp! - Fixes a case where setting vite.server.allowedHosts: true was turned into an invalid array
#15459a4406b4 Thanks @florian-lefebvre! - Fixes a case where context.csp was logging warnings in development that should be logged in production only
#151256feb0d7 Thanks @florian-lefebvre! - Enables the ClientRouter to preserve the original hash part of the target URL during server side redirects.
#1513353b125b Thanks @HiDeoo! - Fixes an issue where adding or removing <style> tags in Astro components would not visually update styles during development without restarting the development server.
#15362dbf71c0 Thanks @jcayzac! - Fixes inferSize being kept in the HTML attributes of the emitted <img> when that option is used with an image that is not remote.
#152146bab8c9 Thanks @ematipico! - Fixes an issue where the internal performance timers weren’t correctly updated to reflect new build pipeline.
#151125751d2b Thanks @HiDeoo! - Fixes a Windows-specific build issue when importing an Astro component with a <script> tag using an import alias.
#15345840fbf9 Thanks @matthewp! - Fixes an issue where .sql files (and other non-asset module types) were incorrectly moved to the client assets folder during SSR builds, causing “no such module” errors at runtime.
The ssrMoveAssets function now reads the Vite manifest to determine which files are actual client assets (CSS and static assets like images) and only moves those, leaving server-side module files in place.
#152598670a69 Thanks @ematipico! - Fixes an issue where styles weren’t correctly reloaded when using the @astrojs/cloudflare adapter.
#15473d653b86 Thanks @matthewp! - Improves Host header handling for SSR deployments behind proxies
#150475580372 Thanks @matthewp! - Fixes wrangler config template in astro add cloudflare to use correct entrypoint and compatibility date
Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new formats configuration option to specify which font formats to download.
Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping woff2 and woff files.
You can now specify what font formats should be downloaded (if available). Only woff2 files are downloaded by default.
What should I do?
If you were previously relying on Astro downloading the woff format, you will now need to specify this explicitly with the new formats configuration option. Additionally, you may also specify any additional file formats to download if available:
astro.config.mjs
import { defineConfig, fontProviders } from 'astro/config'
export default defineConfig({
experimental: {
fonts: [{
name: 'Roboto',
cssVariable: '--font-roboto',
provider: fontProviders.google(),
formats: ['woff2', 'woff', 'otf']
}]
}
})
#151798c8aee6 Thanks @HiDeoo! - Fixes an issue when importing using an import alias a file with a name matching a directory name.
#152696f82aae Thanks @ematipico! - Fixes a regression where build.serverEntry stopped working as expected.
#15053674b63f Thanks @matthewp! - Excludes astro:* and virtual:astro:* from client optimizeDeps in core. Needed for prefetch users since virtual modules are now in the dependency graph.
#1576444daecf Thanks @matthewp! - Fixes form actions incorrectly auto-executing during error page rendering. When an error page (e.g. 404) is rendered, form actions from the original request are no longer executed, since the full request handling pipeline is not active.
#15657cb625b6 Thanks @qzio! - Adds a new security.actionBodySizeLimit option to configure the maximum size of Astro Actions request bodies.
This lets you increase the default 1 MB limit when your actions need to accept larger payloads. For example, actions that handle file uploads or large JSON payloads can now opt in to a higher limit.
If you do not set this option, Astro continues to enforce the 1 MB default to help prevent abuse.
astro.config.mjs
exportdefaultdefineConfig({
security: {
actionBodySizeLimit: 10*1024*1024, // set to 10 MB
},
});
#151769265546 Thanks @matthewp! - Fixes scripts in components not rendering when a sibling <Fragment slot="..."> exists but is unused
#157004e7f3e8 Thanks @ocavue! - Updates the internal logic during SSR by providing additional metadata for UI framework integrations.
#157812de969d Thanks @ematipico! - Adds a new clientAddress option to the createContext() function
Providing this value gives adapter and middleware authors explicit control over the client IP address. When not provided, accessing clientAddress throws an error consistent with other contexts where it is not set by the adapter.
Additionally, both of the official Netlify and Vercel adapters have been updated to provide this information in their edge middleware.
import { createContext } from'astro/middleware';
createContext({
clientAddress: context.headers.get('x-real-ip'),
});
#15755f9ee868 Thanks @matthewp! - Adds a new security.serverIslandBodySizeLimit configuration option
Server island POST endpoints now enforce a body size limit, similar to the existing security.actionBodySizeLimit for Actions. The new option defaults to 1048576 (1 MB) and can be configured independently.
Requests exceeding the limit are rejected with a 413 response. You can customize the limit in your Astro config:
exportdefaultdefineConfig({
security: {
serverIslandBodySizeLimit: 2097152, // 2 MB
},
});
🐞 Patch Changes
#157127ac43c7 Thanks @florian-lefebvre! - Improves astro info by supporting more operating systems when copying the information to the clipboard.
#15780e0ac125 Thanks @ematipico! - Prevents vite.envPrefix misconfiguration from exposing access: "secret" environment variables in client-side bundles. Astro now throws a clear error at startup if any vite.envPrefix entry matches a variable declared with access: "secret" in env.schema.
For example, the following configuration will throw an error for API_SECRET because it’s defined as secret its name matches ['PUBLIC_', 'API_'] defined in env.schema:
#157784ebc1e3 Thanks @ematipico! - Fixes an issue where the computed clientAddress was incorrect in cases of a Request header with multiple values. The clientAddress is now also validated to contain only characters valid in IP addresses, rejecting injection payloads.
#15776e9a9cc6 Thanks @matthewp! - Hardens error page response merging to ensure framing headers from the original response are not carried over to the rendered error page
#1575939ff2a5 Thanks @matthewp! - Adds a new bodySizeLimit option to the @astrojs/node adapter
You can now configure a maximum allowed request body size for your Node.js standalone server. The default limit is 1 GB. Set the value in bytes, or pass 0 to disable the limit entirely:
import node from'@astrojs/node';
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
adapter: node({
mode: 'standalone',
bodySizeLimit: 1024*1024*100, // 100 MB
}),
});
#1577702e24d9 Thanks @matthewp! - Fixes CSRF origin check mismatch by passing the actual server listening port to createRequest, ensuring the constructed URL origin includes the correct port (e.g., http://localhost:4321 instead of http://localhost). Also restricts X-Forwarded-Proto to only be trusted when allowedDomains is configured.
#157686328f1a Thanks @matthewp! - Hardens internal cookie parsing to use a null-prototype object consistently for the fallback path, aligning with how the cookie library handles parsed values
#15757631aaed Thanks @matthewp! - Hardens URL pathname normalization to consistently handle backslash characters after decoding, ensuring middleware and router see the same canonical pathname
#157618939751 Thanks @ematipico! - Fixes an issue where it wasn’t possible to set experimental.queuedRendering.poolSize to 0.
#1576444daecf Thanks @matthewp! - Fixes form actions incorrectly auto-executing during error page rendering. When an error page (e.g. 404) is rendered, form actions from the original request are no longer executed, since the full request handling pipeline is not active.
#15760f49a27f Thanks @ematipico! - Fixed an issue where queued rendering wasn’t correctly re-using the saved nodes.
#1572812ca621 Thanks @SvetimFM! - Improves internal state retention for persisted elements during view transitions, especially avoiding WebGL context loss in Safari and resets of CSS transitions and iframes in modern Chromium and Firefox browsers
#15756b6c64d1 Thanks @matthewp! - Hardens the dev server by validating Sec-Fetch metadata headers to restrict cross-origin subresource requests
#15414faedcc4 Thanks @sapphi-red! - Fixes a bug where some requests to the dev server didn’t start with the leading /.
#1569466449c9 Thanks @matthewp! - Adds preserveBuildClientDir option to adapter features
Adapters can now opt in to preserving the client/server directory structure for static builds by setting preserveBuildClientDir: true in their adapter features. When enabled, static builds will output files to build.client instead of directly to outDir.
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.
my-adapter/index.js
exportdefaultfunctionmyAdapter() {
return {
name: 'my-adapter',
hooks: {
'astro:config:done': ({ setAdapter }) => {
setAdapter({
name: 'my-adapter',
adapterFeatures: {
buildOutput: 'static',
preserveBuildClientDir: true,
},
});
},
},
};
}
#1557908437d5 Thanks @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 .astro pages) or context.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 using experimental.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.cache with a cache provider in your Astro config:
astro.config.mjs
import { defineConfig } from'astro/config';
import node from'@astrojs/node';
import { memoryCache } from'astro/config';
exportdefaultdefineConfig({
adapter: node({ mode: 'standalone' }),
experimental: {
cache: {
provider: memoryCache(),
},
},
});
Using Astro.cache and context.cache
In .astro pages, use Astro.cache.set() to control caching:
src/pages/index.astro
---
Astro.cache.set({
maxAge: 120, // Cache for 2 minutes
swr: 60, // Serve stale for 1 minute while revalidating
tags: ['home'], // Tag for targeted invalidation
});
---
<html><body>Cached page</body></html>
In API routes and middleware, use context.cache:
src/pages/api/data.ts
exportfunctionGET(context) {
context.cache.set({
maxAge: 300,
tags: ['api', 'data'],
});
return Response.json({ ok: true });
}
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 multiple set() calls within a request.
lastModified (Date): When multiple set() calls provide lastModified, 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, lastModified uses most-recent-wins, and tags accumulate.
Invalidation
Purge cached entries by tag or path using cache.invalidate():
Use experimental.routeRules to 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-route cache.set() calls merge with (and can override) the config-level defaults.
You can also read the current cache state via cache.options:
Cache behavior is determined by the configured cache provider. There are two types:
CDN providers set response headers (e.g. CDN-Cache-Control, Cache-Tag) and let the CDN handle caching. Astro strips these headers before sending the response to the client.
Runtime providers implement onRequest() to intercept and cache responses in-process, adding an X-Astro-Cache header (HIT/MISS/STALE) for observability.
Built-in memory cache provider
Astro includes a built-in, in-memory LRU runtime cache provider. Import memoryCache from astro/config to configure it.
Features:
In-memory LRU cache with configurable max entries (default: 1000)
Stale-while-revalidate support
Tag-based and path-based invalidation
X-Astro-Cache response header: HIT, MISS, or STALE
Query parameter sorting for better hit rates (?b=2&a=1 and ?a=1&b=2 hit the same entry)
Common tracking parameters (utm_*, fbclid, gclid, etc.) excluded from cache keys by default
Vary header support — responses that set Vary automatically get separate cache entries per variant
Configurable query parameter filtering via query.exclude (glob patterns) and query.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
#15721e6e146c Thanks @matthewp! - Fixes action route handling to return 404 for requests to prototype method names like constructor or toString used as action paths
The 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.
#15703829182b Thanks @matthewp! - Fixes server islands returning a 500 error in dev mode for adapters that do not set adapterFeatures.buildOutput (e.g. @astrojs/netlify)
#15749573d188 Thanks @ascorbic! - Fixes a bug that caused session.regenerate() to silently lose session data
Previously, regenerated session data was not saved under the new session ID unless set() was also called.
#156851a323e5 Thanks @jcayzac! - Fix regression where SVG images in content collection image() fields could not be rendered as inline components. This behavior is now restored while preserving the TLA deadlock fix.
#15740c5016fc Thanks @matthewp! - Removes an escape hatch that skipped attribute escaping for URL values containing &, ensuring all dynamic attribute values are consistently escaped
#15744fabb710 Thanks @matthewp! - Fixes cookie handling during error page rendering to ensure cookies set by middleware are consistently included in the response
#157429d9699c Thanks @matthewp! - Hardens clientAddress resolution to respect security.allowedDomains for X-Forwarded-For, consistent with the existing handling of X-Forwarded-Host, X-Forwarded-Proto, and X-Forwarded-Port. The X-Forwarded-For header is now only used to determine Astro.clientAddress when the request’s host has been validated against an allowedDomains entry. Without a matching domain, clientAddress falls back to the socket’s remote address.
#15696a9fd221 Thanks @Princesseuh! - Fixes images not working in MDX when using the Cloudflare adapter in certain cases
#157174000aaa Thanks @matthewp! - Ensures that URLs with multiple leading slashes (e.g. //admin) are normalized to a single slash before reaching middleware, so that pathname checks like context.url.pathname.startsWith('/admin') work consistently regardless of the request URL format
#15752918d394 Thanks @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.
#157433b4252a Thanks @matthewp! - Hardens config-based redirects with catch-all parameters to prevent producing protocol-relative URLs (e.g. //example.com) in the Location header
#154955b99e90 Thanks @leekeh! - Adds a new middlewareMode adapter feature to replace the previous edgeMiddleware option.
This feature only impacts adapter authors. If your adapter supports edgeMiddleware, you should upgrade to the new middlewareMode option to specify the middleware mode for your adapter as soon as possible. The edgeMiddleware feature is deprecated and will be removed in a future major release.
#15657cb625b6 Thanks @qzio! - Adds a new security.actionBodySizeLimit option to configure the maximum size of Astro Actions request bodies.
This lets you increase the default 1 MB limit when your actions need to accept larger payloads. For example, actions that handle file uploads or large JSON payloads can now opt in to a higher limit.
If you do not set this option, Astro continues to enforce the 1 MB default to help prevent abuse.
astro.config.mjs
exportdefaultdefineConfig({
security: {
actionBodySizeLimit: 10*1024*1024, // set to 10 MB
#156460dd9d00 Thanks @delucis! - Removes redundant fetchpriority attributes from the output of Astro’s <Image> component
Previously, Astro would always include fetchpriority="auto" on images not using the priority attribute.
However, this is the default value, so specifying it is redundant. This change omits the attribute by default.
🐞 Patch Changes
#156617150a2e Thanks @ematipico! - Fixes a build error when generating projects with 100k+ static routes.
#156035bc2b2c Thanks @0xRozier! - Fixes a deadlock that occurred when using SVG images in content collections
#15589b7dd447 Thanks @qzio! - Adds a new security.actionBodySizeLimit option to configure the maximum size of Astro Actions request bodies.
This lets you increase the default 1 MB limit when your actions need to accept larger payloads. For example, actions that handle file uploads or large JSON payloads can now opt in to a higher limit.
If you do not set this option, Astro continues to enforce the 1 MB default to help prevent abuse.
astro.config.mjs
exportdefaultdefineConfig({
security: {
actionBodySizeLimit: 10*1024*1024, // set to 10 MB
},
});
🐞 Patch Changes
#15594efae11c Thanks @qzio! - Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL.
#1547132b4302 Thanks @ematipico! - Adds a new experimental flag queuedRendering to enable a queue-based rendering engine
The new engine is based on a two-pass process, where the first pass
traverses the tree of components, emits an ordered queue, and then the queue is rendered.
The new engine does not use recursion, and comes with two customizable options.
Early benchmarks showed significant speed improvements and memory efficiency in big projects.
Queue-rendered based
The new engine can be enabled in your Astro config with experimental.queuedRendering.enabled set to true, and can be further customized with additional sub-features.
astro.config.mjs
exportdefaultdefineConfig({
experimental: {
queuedRendering: {
enabled: true,
},
},
});
Pooling
With the new engine enabled, you now have the option to have a pool of nodes that can be saved and reused across page rendering. Node pooling has no effect when rendering pages on demand (SSR) because these rendering requests don’t share memory. However, it can be very useful for performance when building static pages.
astro.config.mjs
exportdefaultdefineConfig({
experimental: {
queuedRendering: {
enabled: true,
poolSize: 2000, // store up to 2k nodes to be reused across renderers
},
},
});
Content caching
The new engine additionally unlocks a new contentCache option. This allows you to cache values of nodes during the rendering phase. This is currently a boolean feature with no further customization (e.g. size of cache) that uses sensible defaults for most large content collections:
When disabled, the pool engine won’t cache strings, but only types.
astro.config.mjs
exportdefaultdefineConfig({
experimental: {
queuedRendering: {
enabled: true,
contentCache: true, // enable re-use of node values
#15543d43841d Thanks @Princesseuh! - Adds a new experimental.rustCompiler flag to opt into the experimental Rust-based Astro compiler
This experimental compiler is faster, provides better error messages, and generally has better support for modern JavaScript, TypeScript, and CSS features.
After enabling in your Astro config, the @astrojs/compiler-rs package must also be installed into your project separately:
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
rustCompiler: true,
},
});
This new compiler is still in early development and may exhibit some differences compared to the existing Go-based compiler. Notably, this compiler is generally more strict in regard to invalid HTML syntax and may throw errors in cases where the Go-based compiler would have been more lenient. For example, unclosed tags (e.g. <p>My paragraph) will now result in errors.
For more information about using this experimental feature in your project, especially regarding expected differences and limitations, please see the experimental Rust compiler reference docs. To give feedback on the compiler, or to keep up with its development, see the RFC for a new compiler for Astro for more information and discussion.
🐞 Patch Changes
#1556530cd6db Thanks @ematipico! - Fixes an issue where the use of the Astro internal logger couldn’t work with Cloudflare Vite plugin.
#15435957b9fe Thanks @rururux! - Improves compatibility of the built-in image endpoint with runtimes that don’t support CJS dependencies correctly
#156404c1a801 Thanks @ematipico! - Reverts the support of Shiki with CSP. Unfortunately, after exhaustive tests, the highlighter can’t be supported to cover all cases.
Adds a warning when both Content Security Policy (CSP) and Shiki syntax highlighting are enabled, as they are incompatible due to Shiki’s use of inline styles
#15605f6473fd Thanks @ascorbic! - Improves .astro component SSR rendering performance by up to 2x.
This includes several optimizations to the way that Astro generates and renders components on the server. These are mostly micro-optimizations, but they add up to a significant improvement in performance. Most pages will benefit, but pages with many components will see the biggest improvement, as will pages with lots of strings (e.g. text-heavy pages with lots of HTML elements).
#15514999a7dd Thanks @veeceey! - Fixes font flash (FOUT) during ClientRouter navigation by preserving inline <style> elements and font preload links in the head during page transitions.
Previously, @font-face declarations from the <Font> component were removed and re-inserted on every client-side navigation, causing the browser to re-evaluate them.
#15580a92333c Thanks @ematipico! - Fixes a build error when generating projects with a large number of static routes
#15549be1c87e Thanks @0xRozier! - Fixes an issue where original (unoptimized) images from prerendered pages could be kept in the build output during SSR builds.
#1556530cd6db Thanks @ematipico! - Fixes an issue where the use of the Code component would result in an unexpected error.
#1558598ea30c Thanks @matthewp! - Add a default body size limit for server actions to prevent oversized requests from exhausting memory.
#1556530cd6db Thanks @ematipico! - Fixes an issue where the new Astro v6 development server didn’t log anything when navigating the pages.
#15573d789452 Thanks @matthewp! - Clear the route cache on content changes so slug pages reflect updated data during dev.
#15560170ed89 Thanks @z0mt3c! - Fix X-Forwarded-Proto validation when allowedDomains includes both protocol and hostname fields. The protocol check no longer fails due to hostname mismatch against the hardcoded test URL.
#15563e959698 Thanks @ematipico! - Fixes an issue where warnings would be logged during the build using one of the official adapters
#15529a509941 Thanks @florian-lefebvre! - Adds a new build-in font provider npm to access fonts installed as NPM packages
You can now add web fonts specified in your package.json through Astro’s type-safe Fonts API. The npm font provider allows you to add fonts either from locally installed packages in node_modules or from a CDN.
Set fontProviders.npm() as your fonts provider along with the required name and cssVariable values, and add options as needed:
#155485b8f573 Thanks @florian-lefebvre! - Adds a new optional embeddedLangs prop to the <Code /> component to support languages beyond the primary lang
This allows, for example, highlighting .vue files with a <script setup lang="tsx"> block correctly:
---
import { Code } from'astro:components';
constcode=`
<script setup lang="tsx">
const Text = ({ text }: { text: string }) => <div>{text}</div>;
#154837be3308 Thanks @florian-lefebvre! - Adds streaming option to the createApp() function in the Adapter API, mirroring the same functionality available when creating a new App instance
An adapter’s createApp() function now accepts streaming (defaults to true) as an option. HTML streaming breaks a document into chunks to send over the network and render on the page in order. This normally results in visitors seeing your HTML as fast as possible but factors such as network conditions and waiting for data fetches can block page rendering.
HTML streaming helps with performance and generally provides a better visitor experience. In most cases, disabling streaming is not recommended.
However, when you need to disable HTML streaming (e.g. your host only supports non-streamed HTML caching at the CDN level), you can opt out of the default behavior by passing streaming: false to createApp():
#154619f21b24 Thanks @florian-lefebvre! - BREAKING CHANGE to the v6 beta Adapter API only: renames entryType to entrypointResolution and updates possible values
Astro 6 introduced a way to let adapters have more control over the entrypoint by passing entryType: 'self' to setAdapter(). However during beta development, the name was unclear and confusing.
entryType is now renamed to entrypointResolution and its possible values are updated:
legacy-dynamic becomes explicit.
self becomes auto.
If you are building an adapter with v6 beta and specifying entryType, update it:
To replace the deprecated NodeApp.createRequest() and NodeApp.writeResponse() methods, the astro/app/node module now exposes new createRequest() and writeResponse() utilities. These can be used to convert a NodeJS IncomingMessage into a web-standard Request and stream a web-standard Response into a NodeJS ServerResponse:
#15407aedbbd8 Thanks @ematipico! - Adds support for responsive images when security.csp is enabled, out of the box.
Astro’s implementation of responsive image styles has been updated to be compatible with a configured Content Security Policy.
Instead of, injecting style elements at runtime, Astro will now generate your styles at build time using a combination of class="" and data-* attributes. This means that your processed styles are loaded and hashed out of the box by Astro.
If you were previously choosing between Astro’s CSP feature and including responsive images on your site, you may now use them together.
🐞 Patch Changes
#155082c6484a Thanks @KTibow! - Fixes behavior when shortcuts are used before server is ready
#15497a93c81d Thanks @matthewp! - Fix dev reloads for content collection Markdown updates under Vite 7.
#15460ee7e53f Thanks @florian-lefebvre! - Updates the Adapter API to allow providing a serverEntrypoint when using entryType: 'self'
Astro 6 introduced a new powerful yet simple Adapter API for defining custom server entrypoints. You can now call setAdapter() with the entryType: 'self' option and specify your custom serverEntrypoint:
exportfunctionmyAdapter() {
return {
name: 'my-adapter',
hooks: {
'astro:config:done': ({ setAdapter }) => {
setAdapter({
name: 'my-adapter',
entryType: 'self',
serverEntrypoint: 'my-adapter/server.js',
supportedAstroFeatures: {
// ...
},
});
},
},
};
}
If you need further customization at the Vite level, you can omit serverEntrypoint and instead specify your custom server entrypoint with vite.build.rollupOptions.input.
🐞 Patch Changes
#15454b47a4e1 Thanks @Fryuni! - Fixes a race condition in the content layer which could result in dropped content collection entries.
#1545050c9129 Thanks @florian-lefebvre! - Fixes a case where build.serverEntry would not be respected when using the new Adapter API
#15473d653b86 Thanks @matthewp! - Improves Host header handling for SSR deployments behind proxies
#152313928b87 Thanks @rururux! - Adds a new optional getRemoteSize() method to the Image Service API.
Previously, inferRemoteSize() had a fixed implementation that fetched the entire image to determine its dimensions.
With this new helper function that extends inferRemoteSize(), you can now override or extend how remote image metadata is retrieved.
This enables use cases such as:
Caching: Storing image dimensions in a database or local cache to avoid redundant network requests.
Provider APIs: Using a specific image provider’s API (like Cloudinary or Vercel) to get dimensions without downloading the file.
For example, you can add a simple cache layer to your existing image service:
#15077a164c77 Thanks @matthewp! - Updates the Integration API to add setPrerenderer() to the astro:build:start hook, allowing adapters to provide custom prerendering logic.
The new API accepts either an AstroPrerenderer object directly, or a factory function that receives the default prerenderer:
'astro:build:start': ({ setPrerenderer }) => {
setPrerenderer((defaultPrerenderer) => ({
name: 'my-prerenderer',
asyncsetup() {
// Optional: called once before prerendering starts
},
asyncgetStaticPaths() {
// Returns array of { pathname: string, route: RouteData }
return defaultPrerenderer.getStaticPaths();
},
asyncrender(request, { routeData }) {
// request: Request
// routeData: RouteData
// Returns: Response
},
asyncteardown() {
// Optional: called after all pages are prerendered
}
}));
}
Also adds the astro:static-paths virtual module, which exports a StaticPaths class for adapters to collect all prerenderable paths from within their target runtime. This is useful when implementing a custom prerenderer that runs in a non-Node environment:
// In your adapter's request handler (running in target runtime)
import { App } from'astro/app';
import { StaticPaths } from'astro:static-paths';
exportfunctioncreateApp(manifest) {
constapp=newApp(manifest);
return {
asyncfetch(request) {
const { pathname } =newURL(request.url);
// Expose endpoint for prerenderer to get static paths
if (pathname ==='/__astro_static_paths') {
conststaticPaths=newStaticPaths(app);
constpaths=await staticPaths.getAll();
returnnewResponse(JSON.stringify({ paths }));
}
// Normal request handling
return app.render(request);
},
};
}
See the adapter reference for more details on implementing a custom prerenderer.
#15345840fbf9 Thanks @matthewp! - Adds a new emitClientAsset function to astro/assets/utils for integration authors. This function allows emitting assets that will be moved to the client directory during SSR builds, useful for assets referenced in server-rendered content that need to be available on the client.
#15423c5ea720 Thanks @matthewp! - Improves error message when a dynamic redirect destination does not match any existing route.
Previously, configuring a redirect like /categories/[category] → /categories/[category]/1 in static output mode would fail with a misleading “getStaticPaths required” error. Now, Astro detects this early and provides a clear error explaining that the destination does not match any existing route.
#1544410b0422 Thanks @AhmadYasser1! - Fixes Astro.rewrite returning 404 when rewriting to a URL with non-ASCII characters
When rewriting to a path containing non-ASCII characters (e.g., /redirected/héllo), the route lookup compared encoded distURL hrefs against decoded pathnames, causing the comparison to always fail and resulting in a 404. This fix compares against the encoded pathname instead.
#15419a18d727 Thanks @ematipico! - Fixes an issue where the add command could accept any arbitrary value, leading the possible command injections. Now add and --add accepts
values that are only acceptable npmjs.org names.
#15345840fbf9 Thanks @matthewp! - Fixes an issue where .sql files (and other non-asset module types) were incorrectly moved to the client assets folder during SSR builds, causing “no such module” errors at runtime.
The ssrMoveAssets function now reads the Vite manifest to determine which files are actual client assets (CSS and static assets like images) and only moves those, leaving server-side module files in place.
#15258d339a18 Thanks @ematipico! - Stabilizes the adapter feature experimentalStatiHeaders. If you were using this feature in any of the supported adapters, you’ll need to change the name of the flag:
export default defineConfig({
adapter: netlify({
experimentalStaticHeaders: true
staticHeaders: true
})
})
🐞 Patch Changes
#151674fca170 Thanks @HiDeoo! - Fixes an issue where CSS from unused components, when using content collections, could be incorrectly included between page navigations in development mode.
#1526854e5cc4 Thanks @rururux! - fix: avoid creating unused images during build in Picture component
#1513353b125b Thanks @HiDeoo! - Fixes an issue where adding or removing <style> tags in Astro components would not visually update styles during development without restarting the development server.
#148884cd3fe4 Thanks @OliverSpeir! - Updates astro add cloudflare to better setup types, by adding ./worker-configuration.d.ts to tsconfig includes and a generate-types script to package.json
Live content collection loaders now receive the collection name as part of their parameters. This is helpful for loaders that manage multiple collections or need to differentiate behavior based on the collection being accessed.
Content collection loaders can now use await import() and import.meta.glob() to dynamically import modules during build. Previously, these would fail with “Vite module runner has been closed.”
#15386a0234a3 Thanks @OliverSpeir! - Updates astro add cloudflare to use the latest valid compatibility_date in the wrangler config, if available
#15362dbf71c0 Thanks @jcayzac! - Fixes inferSize being kept in the HTML attributes of the emitted <img> when that option is used with an image that is not remote.
#153327c55f80 Thanks @matthewp! - Adds frontmatter parsing support to renderMarkdown in content loaders. When markdown content includes frontmatter, it is now extracted and available in metadata.frontmatter, and excluded from the HTML output. This makes renderMarkdown behave consistently with the glob loader.
constloader= {
name: 'my-loader',
load: async ({ store, renderMarkdown }) => {
constcontent=`---
title: My Post
---
# Hello World
`;
constrendered=awaitrenderMarkdown(content);
// rendered.metadata.frontmatter is now { title: 'My Post' }
// rendered.html contains only the content, not the frontmatter
#153327c55f80 Thanks @matthewp! - Adds a fileURL option to renderMarkdown in content loaders, enabling resolution of relative image paths. When provided, relative image paths in markdown will be resolved relative to the specified file URL and included in metadata.localImagePaths.
constloader= {
name: 'my-loader',
load: async ({ store, renderMarkdown }) => {
constcontent=`
# My Post

`;
// Provide a fileURL to resolve relative image paths
// rendered.metadata.localImagePaths now contains the resolved image path
},
};
#1529189b6cdd Thanks @florian-lefebvre! - Adds a new Fonts API to provide first-party support for adding custom fonts in Astro.
This feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including preloading and fallback font generation.
To enable this feature, configure fonts with one or more fonts:
Import and include the <Font /> component with the required cssVariable property in the head of your page, usually in a dedicated Head.astro component or in a layout component directly:
src/layouts/Layout.astro
---
import { Font } from'astro:assets';
---
<html>
<head>
<FontcssVariable="--font-roboto"preload />
</head>
<body>
<slot />
</body>
</html>
In any page rendered with that layout, including the layout component itself, you can now define styles with your font’s cssVariable to apply your custom font.
In the following example, the <h1> heading will have the custom font applied, while the paragraph <p> will not.
src/pages/example.astro
---
import Layout from'../layouts/Layout.astro';
---
<Layout>
<h1>In a galaxy far, far away...</h1>
<p>Custom fonts make my headings much cooler!</p>
<style>
h1 {
font-family: var('--font-roboto');
}
</style>
</Layout>
Visit the updated fonts guide to learn more about adding custom fonts to your project.
🐞 Patch Changes
#153377ff7b11 Thanks @ematipico! - Fixes a bug where the development server couldn’t serve newly created new pages while the development server is running.
#153314592be5 Thanks @matthewp! - Fixes an issue where API routes would overwrite public files during build. Public files now correctly take priority over generated routes in both dev and build modes.
Removes the getFontBuffer() helper function exported from astro:assets when using the experimental Fonts API
This experimental feature introduced in v15.6.13 ended up causing significant memory usage during build. This feature has been removed and will be reintroduced after further exploration and testing.
If you were relying on this function, you can replicate the previous behavior manually:
On prerendered routes, read the file using node:fs
On server rendered routes, fetch files using URLs from fontData and context.url
#15171f220726 Thanks @mark-ignacio! - Adds a new, optional kernel configuration option to select a resize algorithm in the Sharp image service
By default, Sharp resizes images with the lanczos3 kernel. This new config option allows you to set the default resizing algorithm to any resizing option supported by Sharp (e.g. linear, mks2021).
Kernel selection can produce quite noticeable differences depending on various characteristics of the source image - especially drawn art - so changing the kernel gives you more control over the appearance of images on your site:
exportdefaultdefineConfig({
image: {
service: {
entrypoint: 'astro/assets/services/sharp',
config: {
kernel: "mks2021"
}
}
})
This selection will apply to all images on your site, and is not yet configurable on a per-image basis. For more information, see Sharps documentation on resizing images.
#1506308e0fd7 Thanks @jmortlock! - Adds a new partitioned option when setting a cookie to allow creating partitioned cookies.
Partitioned cookies can only be read within the context of the top-level site on which they were set. This allows cross-site tracking to be blocked, while still enabling legitimate uses of third-party cookies.
You can create a partitioned cookie by passing partitioned: true when setting a cookie. Note that partitioned cookies must also be set with secure: true:
#15022f1fce0e Thanks @ascorbic! - Adds a new retainBody option to the glob() loader to allow reducing the size of the data store.
Currently, the glob() loader stores the raw body of each content file in the entry, in addition to the rendered HTML.
The retainBody option defaults to true, but you can set it to false to prevent the raw body of content files from being stored in the data store. This significantly reduces the deployed size of the data store and helps avoid hitting size limits for sites with very large collections.
The rendered body will still be available in the entry.rendered.html property for markdown files, and the entry.filePath property will still point to the original file.
import { defineCollection } from'astro:content';
import { glob } from'astro/loaders';
constblog=defineCollection({
loader: glob({
pattern: '**/*.md',
base: './src/content/blog',
retainBody: false,
}),
});
When retainBody is false, entry.body will be undefined instead of containing the raw file contents.
#15153928529f Thanks @jcayzac! - Adds a new background property to the <Image /> component.
This optional property lets you pass a background color to flatten the image with. By default, Sharp uses a black background when flattening an image that is being converted to a format that does not support transparency (e.g. jpeg). Providing a value for background on an <Image /> component, or passing it to the getImage() helper, will flatten images using that color instead.
This is especially useful when the requested output format doesn’t support an alpha channel (e.g. jpeg) and can’t support transparent backgrounds.
#1501554f6006 Thanks @tony! - Adds optional placement config option for the dev toolbar.
You can now configure the default toolbar position ('bottom-left', 'bottom-center', or 'bottom-right') via devToolbar.placement in your Astro config. This option is helpful for sites with UI elements (chat widgets, cookie banners) that are consistently obscured by the toolbar in the dev environment.
You can set a project default that is consistent across environments (e.g. dev machines, browser instances, team members):
astro.config.mjs
exportdefaultdefineConfig({
devToolbar: {
placement: 'bottom-left',
},
});
User preferences from the toolbar UI (stored in localStorage) still take priority, so this setting can be overridden in individual situations as necessary.
#15281a1b80c6 Thanks @matthewp! - Ensures server island requests carry an encrypted component export identifier so they do not accidentally resolve to the wrong component.
#1530889cbcfa Thanks @matthewp! - Fixes styles missing in dev for prerendered pages when using Cloudflare adapter
#152798983f17 Thanks @ematipico! - Fixes an issue where the dev server would serve files like /README.md from the project root when they shouldn’t be accessible. A new route guard middleware now blocks direct URL access to files that exist outside of srcDir and publicDir, returning a 404 instead.
#15277cb99214 Thanks @ematipico! - Fixes an issue where the function createShikiHighlighter would always create a new Shiki highlighter instance. Now the function returns a cached version of the highlighter based on the Shiki options. This should improve the performance for sites that heavily rely on Shiki and code in their pages.
#1526411efb05 Thanks @florian-lefebvre! - Lower the Node version requirement to allow running on Stackblitz until it supports v22
#152860aafc83 Thanks @florian-lefebvre! - Fixes a case where font providers provided as class instances may not work when using the experimental Fonts API. It affected the local provider
Updates how the local provider must be used when using the experimental Fonts API
Previously, there were 2 kinds of font providers: remote and local.
Font providers are now unified. If you are using the local provider, the process for configuring local fonts must be updated:
import { defineConfig } from "astro/config";
import { defineConfig, fontProviders } from "astro/config";
export default defineConfig({
experimental: {
fonts: [{
name: "Custom",
cssVariable: "--font-custom",
provider: "local",
provider: fontProviders.local(),
options: {
variants: [
{
weight: 400,
style: "normal",
src: ["./src/assets/fonts/custom-400.woff2"]
},
{
weight: 700,
style: "normal",
src: ["./src/assets/fonts/custom-700.woff2"]
}
// ...
]
}
}]
}
});
Once configured, there is no change to using local fonts in your project. However, you should inspect your deployed site to confirm that your new font configuration is being applied.
When building a custom FontProvider for the experimental Fonts API, the init() method receives a context. This context now exposes a root URL, useful for resolving local files:
import type { FontProvider } from "astro";
export function registryFontProvider(): FontProvider {
return {
// ...
init: async ({ storage }) => {
init: async ({ storage, root }) => {
// ...
},
};
}
#15185edabeaa Thanks @EricGrill! - Add .vercel to .gitignore when adding the Vercel adapter via astro add vercel
#15266f7c9365 Thanks @florian-lefebvre! - Allows Astro.csp and context.csp to be undefined instead of throwing errors when csp: true is not configured
When using the experimental Content Security Policy feature in Astro 5.x, context.csp was always defined but would throw if experimental.csp was not enabled in the Astro config.
For the stable version of this API in Astro 6, context.csp can now be undefined if CSP is not enabled and its methods will never throw.
What should I do?
If you were using experimental CSP runtime utilities, you must now access methods conditionally:
Astro.csp.insertDirective("default-src 'self'");
Astro.csp?.insertDirective("default-src 'self'");
🐞 Patch Changes
#152088dbdd8e Thanks @matthewp! - Makes session.driver optional in config schema, allowing adapters to provide default drivers
Adapters like Cloudflare, Netlify, and Node provide default session drivers, so users can now configure session options (like ttl) without explicitly specifying a driver.
#15260abca1eb Thanks @ematipico! - Fixes an issue where adding new pages weren’t correctly shown when using the development server.
#152146bab8c9 Thanks @ematipico! - Fixes an issue where the internal perfomance timers weren’t correctly updated to reflect new build pipeline.
#152598670a69 Thanks @ematipico! - Fixes an issue where styles weren’t correctly reloaded when using the @astrojs/cloudflare adapter.
#1520512adc55 Thanks @martrapp! - Fixes an issue where the astro:page-load event did not fire on initial page loads.
#152696f82aae Thanks @ematipico! - Fixes a regression where build.serverEntry stopped working as expected.
#15182cb60ee1 Thanks @florian-lefebvre! - Adds a new getFontBuffer() method to retrieve font file buffers when using the experimental Fonts API
The getFontData() helper function from astro:assets was introduced in 5.14.0 to provide access to font family data for use outside of Astro. One of the goals of this API was to be able to retrieve buffers using URLs.
However, it turned out to be impactical and even impossible during prerendering.
Astro now exports a new getFontBuffer() helper function from astro:assets to retrieve font file buffers from URL returned by getFontData(). For example, when using satori to generate OpenGraph images:
src/pages/og.png.ts
import type{ APIRoute } from "astro"
import { getFontData } from "astro:assets"
import { getFontData, getFontBuffer } from "astro:assets"
Previously, an Astro FontProvider could only accept options at the provider level when called. That could result in weird data structures for family-specific options.
Astro FontProviders can now declare family-specific options, by specifying a generic:
font-provider.ts
import type { FontProvider } from "astro";
import { retrieveFonts, type Fonts } from "./utils.js",
interface Config {
token: string;
}
interface FamilyOptions {
minimal?: boolean;
}
export function registryFontProvider(config: Config): FontProvider {
export function registryFontProvider(config: Config): FontProvider<FamilyOptions> {
Removes getFontData() exported from astro:assets with fontData when using the experimental Fonts API
Accessing font data can be useful for advanced use cases, such as generating meta tags or Open Graph images. Before, we exposed a getFontData() helper function to retrieve the font data for a given cssVariable. That was however limiting for programmatic usages that need to access all font data.
The getFontData() helper function is removed and replaced by a new fontData object:
import { getFontData } from "astro:assets";
const data = getFontData("--font-roboto")
import { fontData } from "astro:assets";
const data = fontData["--font-roboto"]
We may reintroduce getFontData() later on for a more friendly DX, based on your feedback.
#152548d84b30 Thanks @lamalex! - Fixes CSS assetsPrefix with remote URLs incorrectly prepending a forward slash
When using build.assetsPrefix with a remote URL (e.g., https://cdn.example.com) for CSS assets, the generated <link> elements were incorrectly getting a / prepended to the full URL, resulting in invalid URLs like /https://cdn.example.com/assets/style.css.
This fix checks if the stylesheet link is a remote URL before prepending the forward slash.
#15178731f52d Thanks @kedarvartak! - Fixes an issue where stopping the dev server with q+enter incorrectly created a dist folder and copied font files when using the experimental Fonts API
#152303da6272 Thanks @rahuld109! - Fixes greedy regex in error message markdown rendering that caused link syntax examples to capture extra characters
#152532a6315a Thanks @matthewp! - Fixes hydration for React components nested inside HTML elements in MDX files
#152279a609f4 Thanks @matthewp! - Fixes styles not being included for conditionally rendered Svelte 5 components in production builds
#14607ee52160 Thanks @simensfo! - Reintroduces css deduplication for hydrated client components. Ensures assets already added to a client chunk are not flagged as orphaned
2fa19c4 - Improved error handling in the rendering phase
Added defensive validation in App.render() and #renderError() to provide a descriptive error message when a route module doesn’t have a valid page function.
#15199d8e64ef Thanks @ArmandPhilippot! - Fixes the links to Astro Docs so that they match the current docs structure.
#15169b803d8b Thanks @rururux! - fix: fix image 500 error when moving dist directory in standalone Node
#146229b35c62 Thanks @aprici7y! - Fixes CSS url() references to public assets returning 404 in dev mode when base path is configured
#151256feb0d7 Thanks @florian-lefebvre! - Improves JSDoc annotations for AstroGlobal, AstroSharedContext and APIContext types
#151769265546 Thanks @matthewp! - Fixes hydration for framework components inside MDX when using Astro.slots.render()
Previously, when multiple framework components with client:* directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts.
#1512106261e0 Thanks @ematipico! - Fixes a bug where the Astro, with the Cloudlfare integration, couldn’t correctly serve certain routes in the development server.
#151256feb0d7 Thanks @florian-lefebvre! - Fixes images not working in development when using setups with port forwarding
#151372f70bf1 Thanks @matthewp! - Adds legacy.collectionsBackwardsCompat flag that restores v5 backwards compatibility behavior for legacy content collections - (v6 upgrade guidance)
When enabled, this flag allows:
Collections defined without loaders (automatically get glob loader)
Collections with type: 'content' or type: 'data'
Config files located at src/content/config.ts (legacy location)
Legacy entry API: entry.slug and entry.render() methods
Path-based entry IDs instead of slug-based IDs
astro.config.mjs
exportdefaultdefineConfig({
legacy: {
collectionsBackwardsCompat: true,
},
});
This is a temporary migration helper for v6 upgrades. Migrate collections to the Content Layer API, then disable this flag.
Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new formats configuration option to specify which font formats to download.
Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping woff2 and woff files.
You can now specify what font formats should be downloaded (if available). Only woff2 files are downloaded by default.
What should I do?
If you were previously relying on Astro downloading the woff format, you will now need to specify this explicitly with the new formats configuration option. Additionally, you may also specify any additional file formats to download if available:
astro.config.mjs
import { defineConfig, fontProviders } from 'astro/config'
export default defineConfig({
experimental: {
fonts: [{
name: 'Roboto',
cssVariable: '--font-roboto',
provider: fontProviders.google(),
formats: ['woff2', 'woff', 'otf']
}]
}
})
#151798c8aee6 Thanks @HiDeoo! - Fixes an issue when importing using an import alias a file with a name matching a directory name.
#151769265546 Thanks @matthewp! - Fixes scripts in components not rendering when a sibling <Fragment slot="..."> exists but is unused
#15150a77c4f4 Thanks @matthewp! - Fixes hydration for framework components inside MDX when using Astro.slots.render()
Previously, when multiple framework components with client:* directives were passed as named slots to an Astro component in MDX, only the first slot would hydrate correctly. Subsequent slots would render their HTML but fail to include the necessary hydration scripts.
Changes how font providers are implemented with updates to the FontProvider type
This is an implementation detail that changes how font providers are created. This process allows Astro to take more control rather than relying directly on unifont types. All of Astro’s built-in font providers have been updated to reflect this new type, and can be configured as before. However, using third-party unifont providers that rely on unifont types will require an update to your project code.
Previously, an Astro FontProvider was made of a config and a runtime part. It relied directly on unifont types, which allowed a simple configuration for third-party unifont providers, but also coupled Astro’s implementation to unifont, which was limiting.
Astro’s font provider implementation is now only made of a config part with dedicated hooks. This allows for the separation of config and runtime, but requires you to create a font provider object in order to use custom font providers (e.g. third-party unifont providers, or private font registeries).
What should I do?
If you were using a 3rd-party unifont font provider, you will now need to write an Astro FontProvider using it under the hood. For example:
astro.config.ts
import { defineConfig } from "astro/config";
import { acmeProvider, type AcmeOptions } from '@acme/unifont-provider'
import type { FontProvider } from "astro";
import type { InitializedProvider } from 'unifont';
function acme(config?: AcmeOptions): FontProvider {
const provider = acmeProvider(config);
let initializedProvider: InitializedProvider | undefined;
#1512481db3c0 Thanks @leonace924! - Fixes an issue where requests with query parameters to the base path would return a 404 if trailingSlash was not 'ignore' in development
#1515239ee41f Thanks @rururux! - Fixes a case where context.cookies.set() would be overriden when setting cookies via response headers in development
Changes the font format downloaded by default when using the experimental Fonts API. Additionally, adds a new formats configuration option to specify which font formats to download.
Previously, Astro was opinionated about which font sources would be kept for usage, mainly keeping woff2 and woff files.
You can now specify what font formats should be downloaded (if available). Only woff2 files are downloaded by default.
What should I do?
If you were previously relying on Astro downloading the woff format, you will now need to specify this explicitly with the new formats configuration option. Additionally, you may also specify any additional file formats to download if available:
astro.config.mjs
import { defineConfig, fontProviders } from 'astro/config'
For greater flexibility and improved consistency with other Astro code, session drivers are now specified as an object:
import { defineConfig } from 'astro/config'
import { defineConfig, sessionDrivers } from 'astro/config'
export default defineConfig({
session: {
driver: 'redis',
options: {
url: process.env.REDIS_URL
},
driver: sessionDrivers.redis({
url: process.env.REDIS_URL
}),
}
})
Specifying the session driver as a string has been deprecated, but will continue to work until this feature is removed completely in a future major version. The object shape is the current recommended and documented way to configure a session driver.
#150475580372 Thanks @matthewp! - Fixes wrangler config template in astro add cloudflare to use correct entrypoint and compatibility date
#15053674b63f Thanks @matthewp! - Excludes astro:* and virtual:astro:* from client optimizeDeps in core. Needed for prefetch users since virtual modules are now in the dependency graph.
#149826849e38 Thanks @Princesseuh! - Fixes images outside the project directory not working when using astro:assets in development mode
#149879dd9fca Thanks @Princesseuh! - Fixes SVGs not working in dev mode when using the passthrough image service
#15014a178422 Thanks @delucis! - Adds support for extending the type of the props accepted by Astro’s <Image> component, <Picture> component, and getImage() API.
#14759d7889f7 Thanks @florian-lefebvre! - Removes the option to define dynamic schemas in content loaders as functions and adds a new equivalent createSchema() property (Loader API) - (v6 upgrade guidance)
#14306141c4a2 Thanks @ematipico! - Adds new optional properties to setAdapter() for adapter entrypoint handling in the Adapter API
Changes:
New optional properties:
devEntrypoint?: string | URL - specifies custom dev server entrypoint
entryType?: 'self' | 'legacy-dynamic' - determines if the adapter provides its own entrypoint ('self') or if Astro constructs one ('legacy-dynamic', default)
Migration: Adapter authors can optionally add these properties to support custom dev entrypoints. If not specified, adapters will use the legacy behavior.
#14826170f64e Thanks @florian-lefebvre! - Adds an option prerenderConflictBehavior to configure the behavior of conflicting prerendered routes
By default, Astro warns you during the build about any conflicts between multiple dynamic routes that can result in the same output path. For example /blog/[slug] and /blog/[...all] both could try to prerender the /blog/post-1 path. In such cases, Astro renders only the highest priority route for the conflicting path. This allows your site to build successfully, although you may discover that some pages are rendered by unexpected routes.
With the new prerenderConflictBehavior configuration option, you can now configure this further:
prerenderConflictBehavior: 'error' fails the build
prerenderConflictBehavior: 'warn' (default) logs a warning and the highest-priority route wins
prerenderConflictBehavior: 'ignore' silently picks the highest-priority route when conflicts occur
#14985c016f10 Thanks @florian-lefebvre! - Fixes a case where JSDoc annotations wouldn’t show for fonts related APIs in the Astro config
#14973ed7cc2f Thanks @amankumarpandeyin! - Fixes performance regression and OOM errors when building medium-sized blogs with many content entries. Replaced O(n²) object spread pattern with direct mutation in generateLookupMap.
#1495870eb542 Thanks @ascorbic! - Gives a helpful error message if a user sets output: "hybrid" in their Astro config.
The option was removed in Astro 5, but lots of content online still references it, and LLMs often suggest it. It’s not always clear that the replacement is output: "static", rather than output: "server". This change adds a helpful error message to guide humans and robots.
#14901ef53716 Thanks @Darknab! - Updates the glob() loader to log a warning when duplicated IDs are detected
#149402cf79c2 Thanks @ematipico! - Fixes a bug where Astro didn’t properly combine CSP resources from the csp configuration with those added using the runtime API (Astro.csp.insertDirective()) to form grammatically correct CSP headers
Now Astro correctly deduplicate CSP resources. For example, if you have a global resource in the configuration file, and then you add a
a new one using the runtime APIs.
#14929e0f277d Thanks @matthewp! - Fixes authentication bypass via double URL encoding in middleware
Prevents attackers from bypassing path-based authentication checks using multi-level URL encoding (e.g., /%2561dmin instead of /%61dmin). Pathnames are now validated after decoding to ensure no additional encoding remains.
#1488410273e0 Thanks @florian-lefebvre! - Fixes a case where setting the status of a page to 404 in ssr would show an empty page (or 404.astro page if provided) instead of using the current page
#148941ad9a5b Thanks @delucis! - Fixes support for Astro component rendering in Vitest test suites using a “client” environment such as happy-dom or jsdom
#138801a2ed01 Thanks @azat-io! - Adds experimental SVGO optimization support for SVG assets
Astro now supports automatic SVG optimization using SVGO during build time. This experimental feature helps reduce SVG file sizes while maintaining visual quality, improving your site’s performance.
To enable SVG optimization with default settings, add the following to your astro.config.mjs:
#148102e845fe Thanks @ascorbic! - Adds a hint for code agents to use the --yes flag to skip prompts when running astro add
#14698f42ff9b Thanks @mauriciabad! - Adds the ActionInputSchema utility type to automatically infer the TypeScript type of an action’s input based on its Zod schema
For example, this type can be used to retrieve the input type of a form action:
import { type ActionInputSchema, defineAction } from'astro:actions';
import { z } from'astro/zod';
constaction=defineAction({
accept: 'form',
input: z.object({ name: z.string() }),
handler: ({ name }) => ({ message: `Welcome, ${name}!` }),
#14786758a891 Thanks @mef! - Add handling of invalid encrypted props and slots in server islands.
#14783504958f Thanks @florian-lefebvre! - Improves the experimental Fonts API build log to show the number of downloaded files. This can help spotting excessive downloading because of misconfiguration
#147919e9c528 Thanks @Princesseuh! - Changes the remote protocol checks for images to require explicit authorization in order to use data URIs.
In order to allow data URIs for remote images, you will need to update your astro.config.mjs file to include the following configuration:
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
images: {
remotePatterns: [
{
protocol: 'data',
},
],
},
});
#147870f75f6b Thanks @matthewp! - Fixes wildcard hostname pattern matching to correctly reject hostnames without dots
Previously, hostnames like localhost or other single-part names would incorrectly match patterns like *.example.com. The wildcard matching logic has been corrected to ensure that only valid subdomains matching the pattern are accepted.
#147763537876 Thanks @ktym4a! - Fixes the behavior of passthroughImageService so it does not generate webp.
#1477200c579a Thanks @matthewp! - Improves the security of Server Islands slots by encrypting them before transmission to the browser, matching the security model used for props. This improves the integrity of slot content and prevents injection attacks, even when component templates don’t explicitly support slots.
Slots continue to work as expected for normal usage—this change has no breaking changes for legitimate requests.
Middleware now receives normalized pathname values, ensuring that encoded paths like /%61dmin are properly decoded to /admin before middleware checks. This prevents potential security issues where middleware checks might be bypassed through URL encoding.
#1476503fb47c Thanks @florian-lefebvre! - Fixes a case where process.env wouldn’t be properly populated during the build
#14690ae7197d Thanks @fredriknorlin! - Fixes a bug where Astro’s i18n fallback system with fallbackType: 'rewrite' would not generate fallback files for pages whose filename started with a locale key.
#1475118c55e1 Thanks @delucis! - Fixes hydration of client components when running the dev server and using a barrel file that re-exports both Astro and UI framework components.
#1475035122c2 Thanks @florian-lefebvre! - Updates the experimental Fonts API to log a warning if families with a conflicting cssVariable are provided
#1473774c8852 Thanks @Arecsu! - Fixes an error when using transition:persist with components that use declarative Shadow DOM. Astro now avoids re-attaching a shadow root if one already exists, preventing "Unable to re-attach to existing ShadowDOM" navigation errors.
#1475035122c2 Thanks @florian-lefebvre! - Updates the experimental Fonts API to allow for more granular configuration of remote font families
A font family is defined by a combination of properties such as weights and styles (e.g. weights: [500, 600] and styles: ["normal", "bold"]), but you may want to download only certain combinations of these.
For greater control over which font files are downloaded, you can specify the same font (ie. with the same cssVariable, name, and provider properties) multiple times with different combinations. Astro will merge the results and download only the required files. For example, it is possible to download normal 500 and 600 while downloading only italic 500:
#14743dafbb1b Thanks @matthewp! - Improves X-Forwarded header validation to prevent cache poisoning and header injection attacks. Now properly validates X-Forwarded-Proto, X-Forwarded-Host, and X-Forwarded-Port headers against configured allowedDomains patterns, rejecting malformed or suspicious values. This is especially important when running behind a reverse proxy or load balancer.
#14703970ac0f Thanks @ArmandPhilippot! - Adds missing documentation for some public utilities exported from astro:i18n.
#147153d55c5d Thanks @ascorbic! - Adds support for client hydration in getContainerRenderer()
The getContainerRenderer() function is exported by Astro framework integrations to simplify the process of rendering framework components when using the experimental Container API inside a Vite or Vitest environment. This update adds the client hydration entrypoint to the returned object, enabling client-side interactivity for components rendered using this function. Previously this required users to manually call container.addClientRenderer() with the appropriate client renderer entrypoint.
#14711a4d284d Thanks @deining! - Fixes typos in documenting our error messages and public APIs.
#147019be54c7 Thanks @florian-lefebvre! - Fixes a case where the experimental Fonts API would filter available font files too aggressively, which could prevent the download of woff files when using the google provider
#14623c5fe295 Thanks @delucis! - Fixes a leak of server runtime code when importing SVGs in client-side code. Previously, when importing an SVG file in client code, Astro could end up adding code for rendering SVGs on the server to the client bundle.
#145439b3241d Thanks @matthewp! - Adds two new adapter configuration options assetQueryParams and internalFetchHeaders to the Adapter API.
Official and community-built adapters can now use client.assetQueryParams to specify query parameters that should be appended to asset URLs (CSS, JavaScript, images, fonts, etc.). The query parameters are automatically appended to all generated asset URLs during the build process.
Adapters can also use client.internalFetchHeaders to specify headers that should be included in Astro’s internal fetch calls (Actions, View Transitions, Server Islands, Prefetch).
This enables features like Netlify’s skew protection, which requires the deploy ID to be sent with both internal requests and asset URLs to ensure client and server versions match during deployments.
#14489add4277 Thanks @dev-shetty! - Adds a new Copy to Clipboard button to the error overlay stack trace.
When an error occurs in dev mode, you can now copy the stack trace with a single click to more easily share it in a bug report, a support thread, or with your favorite LLM.
Running astro add cloudflare will now emit wrangler.jsonc and public/.assetsignore, allowing your Astro project to work out of the box as a worker.
🐞 Patch Changes
#145913e887ec Thanks @matthewp! - Adds TypeScript support for the components prop on MDX Content component when using await render(). Developers now get proper IntelliSense and type checking when passing custom components to override default MDX element rendering.
#145987b45c65 Thanks @delucis! - Reduces terminal text styling dependency size by switching from kleur to picocolors
#138268079482 Thanks @florian-lefebvre! - Adds the option to specify in the preload directive which weights, styles, or subsets to preload for a given font family when using the experimental Fonts API:
Variable weight font files will be preloaded if any weight within its range is requested. For example, a font file for font weight 100 900 will be included when 400 is specified in a preload object.
#1461218552c7 Thanks @ematipico! - Fixes a regression introduced in Astro v5.14.7 that caused ?url imports to not work correctly. This release reverts #14142.
#14590577d051 Thanks @matthewp! - Fixes image path resolution in content layer collections to support bare filenames. The image() helper now normalizes bare filenames like "cover.jpg" to relative paths "./cover.jpg" for consistent resolution behavior between markdown frontmatter and JSON content collections.
#1456794500bb Thanks @matthewp! - Fixes the actions endpoint to return 404 for non-existent actions instead of throwing an unhandled error
#14566946fe68 Thanks @matthewp! - Fixes handling malformed cookies gracefully by returning the unparsed value instead of throwing
When a cookie with an invalid value is present (e.g., containing invalid URI sequences), Astro.cookies.get() now returns the raw cookie value instead of throwing a URIError. This aligns with the behavior of the underlying cookie package and prevents crashes when manually-set or corrupted cookies are encountered.
#1414273c5de9 Thanks @P4tt4te! - Updates handling of CSS for hydrated client components to prevent duplicates
#145762af62c6 Thanks @aprici7y! - Fixes a regression that caused Astro.site to always be undefined in getStaticPaths()
#145486cdade4 Thanks @ascorbic! - Removes support for the maxAge property in cacheHint objects returned by live loaders.
:warning: Breaking change for experimental live content collections only
Feedback showed that this did not make sense to set at the loader level, since the loader does not know how long each individual entry should be cached for.
If your live loader returns cache hints with maxAge, you need to remove this property:
return {
entries: [...],
cacheHint: {
tags: ['my-tag'],
maxAge: 60,
lastModified: new Date(),
},
};
The cacheHint object now only supports tags and lastModified properties. If you want to set the max age for a page, you can set the headers manually:
#145486cdade4 Thanks @ascorbic! - Adds missing rendered property to experimental live collections entry type
Live collections support a rendered property that allows you to provide pre-rendered HTML for each entry. While this property was documented and implemented, it was missing from the TypeScript types. This could lead to type errors when trying to use it in a TypeScript project.
No changes to your project code are necessary. You can continue to use the rendered property as before, and it will no longer produce TypeScript errors.
#1444162ec8ea Thanks @upsuper! - Updates redirect handling to be consistent across static and server output, aligning with the behavior of other adapters.
Previously, the Node.js adapter used default HTML files with meta refresh tags when in static output. This often resulted in an extra flash of the page on redirect, while also not applying the proper status code for redirections. It’s also likely less friendly to search engines.
This update ensures that configured redirects are always handled as HTTP redirects regardless of output mode, and the default HTML files for the redirects are no longer generated in static output. It makes the Node.js adapter more consistent with the other official adapters.
No change to your project is required to take advantage of this new adapter functionality. It is not expected to cause any breaking changes. However, if you relied on the previous redirecting behavior, you may need to handle your redirects differently now. Otherwise you should notice smoother redirects, with more accurate HTTP status codes, and may potentially see some SEO gains.
#14506ec3cbe1 Thanks @abdo-spices! - Updates the <Font /> component so that preload links are generated after the style tag, as recommended by capo.js
#13520a31edb8 Thanks @openscript! - Adds a new property routePattern available to GetStaticPathsOptions
This provides the original, dynamic segment definition in a routing file path (e.g. /[...locale]/[files]/[slug]) from the Astro render context that would not otherwise be available within the scope of getStaticPaths(). This can be useful to calculate the params and props for each page route.
For example, you can now localize your route segments and return an array of static paths by passing routePattern to a custom getLocalizedData() helper function. The params object will be set with explicit values for each route segment (e.g. locale, files, and slug). Then, these values will be used to generate the routes and can be used in your page template via Astro.params.
src/pages/[...locale]/[files]/[slug].astro
import { getLocalizedData } from "../../../utils/i18n"; export async function getStaticPaths({ routePattern
Previously, when two dynamic routes /[foo] and /[bar] returned values on their getStaticPaths that resulted in the same final path, only one of the routes would be rendered while the other would be silently ignored. Now, when this happens, a warning will be displayed explaining which routes collided and on which path.
Additionally, a new experimental flag failOnPrerenderConflict can be used to fail the build when such a collision occurs.
🐞 Patch Changes
#1381169572c0 Thanks @florian-lefebvre! - Adds a new getFontData() method to retrieve lower-level font family data programmatically when using the experimental Fonts API
The getFontData() helper function from astro:assets provides access to font family data for use outside of Astro. This can then be used in an API Route or to generate your own meta tags.
import { getFontData } from'astro:assets';
constdata=getFontData('--font-roboto');
For example, getFontData() can get the font buffer from the URL when using satori to generate OpenGraph images:
#14409250a595 Thanks @louisescher! - Fixes an issue where astro info would log errors to console in certain cases.
#14398a7df80d Thanks @idawnlight! - Fixes an unsatisfiable type definition when calling addServerRenderer on an experimental container instance
#13747120866f Thanks @jp-knj! - Adds automatic request signal abortion when the underlying socket closes in the Node.js adapter
The Node.js adapter now automatically aborts the request.signal when the client connection is terminated. This enables better resource management and allows applications to properly handle client disconnections through the standard AbortSignal API.
#1442832a8acb Thanks @drfuzzyness! - Force sharpService to return a Uint8Array if Sharp returns a SharedArrayBuffer
#14411a601186 Thanks @GameRoMan! - Fixes relative links to docs that could not be opened in the editor.
#14300bd4a70b Thanks @louisescher! - Adds Vite version & integration versions to output of astro info
#14341f75fd99 Thanks @delucis! - Fixes support for declarative Shadow DOM when using the <ClientRouter> component
#14350f59581f Thanks @ascorbic! - Improves error reporting for content collections by adding logging for configuration errors that had previously been silently ignored. Also adds a new error that is thrown if a live collection is used in content.config.ts rather than live.config.ts.
#1426086a1e40 Thanks @jp-knj! - Fixes Astro.url.pathname to respect trailingSlash: 'never' configuration when using a base path. Previously, the root path with a base would incorrectly return /base/ instead of /base when trailingSlash was set to ‘never’.
#14248e81c4bd Thanks @julesyoungberg! - Fixes a bug where actions named ‘apply’ do not work due to being a function prototype method.
#14239d7d93e1 Thanks @wtchnm! - Fixes a bug where the types for the live content collections were not being generated correctly in dev mode
#14221eadc9dd Thanks @delucis! - Fixes JSON schema support for content collections using the file() loader
#142291a9107a Thanks @jonmichaeldarby! - Ensures Astro.currentLocale returns the correct locale during SSG for pages that use a locale param (such as [locale].astro or [locale]/index.astro, which produce [locale].html)
4d16de7 Thanks @ematipico! - Improves the detection of remote paths in the _image endpoint. Now href parameters that start with // are considered remote paths.
#1417339911b8 Thanks @florian-lefebvre! - Adds an experimental flag staticImportMetaEnv to disable the replacement of import.meta.env values with process.env calls and their coercion of environment variable values. This supersedes the rawEnvValues experimental flag, which is now removed.
Astro allows you to configure a type-safe schema for your environment variables, and converts variables imported via astro:env into the expected type. This is the recommended way to use environment variables in Astro, as it allows you to easily see and manage whether your variables are public or secret, available on the client or only on the server at build time, and the data type of your values.
However, you can still access environment variables through process.env and import.meta.env directly when needed. This was the only way to use environment variables in Astro before astro:env was added in Astro 5.0, and Astro’s default handling of import.meta.env includes some logic that was only needed for earlier versions of Astro.
The experimental.staticImportMetaEnv flag updates the behavior of import.meta.env to align with Vite’s handling of environment variables and for better ease of use with Astro’s current implementations and features. This will become the default behavior in Astro 6.0, and this early preview is introduced as an experimental feature.
Currently, non-public import.meta.env environment variables are replaced by a reference to process.env. Additionally, Astro may also convert the value type of your environment variables used through import.meta.env, which can prevent access to some values such as the strings "true" (which is converted to a boolean value), and "1" (which is converted to a number).
The experimental.staticImportMetaEnv flag simplifies Astro’s default behavior, making it easier to understand and use. Astro will no longer replace any import.meta.env environment variables with a process.env call, nor will it coerce values.
To enable this feature, add the experimental flag in your Astro config and remove rawEnvValues if it was enabled:
astro.config.mjs
import { defineConfig } from "astro/config";
export default defineConfig({
experimental: {
staticImportMetaEnv: true
rawEnvValues: false
}
});
Updating your project
If you were relying on Astro’s default coercion, you may need to update your project code to apply it manually:
This feature allows you to edit files directly in the browser and have those changes reflected in your local file system via a connected workspace folder. This allows you to apply edits such as CSS tweaks without leaving your browser tab!
With this feature enabled, the Astro dev server will automatically configure a Chrome DevTools workspace for your project. Your project will then appear as a workspace source, ready to connect. Then, changes that you make in the “Sources” panel are automatically saved to your project source code.
To enable this feature, add the experimental flag chromeDevtoolsWorkspace to your Astro config:
#140209518975 Thanks @jp-knj and @asieradzk! - Prevent double-prefixed redirect paths when using fallback and redirectToDefaultLocale together
Fixes an issue where i18n fallback routes would generate double-prefixed paths (e.g., /es/es/test/item1/) when fallback and redirectToDefaultLocale configurations were used together. The fix adds proper checks to prevent double prefixing in route generation.
#141993e4cb8e Thanks @ascorbic! - Fixes a bug that prevented HMR from working with inline styles
#14169f4e8889 Thanks @ascorbic! - Skips trailing slash handling for paths that start with /..
#1417034e6b3a Thanks @ematipico! - Fixes an issue where static redirects couldn’t correctly generate a redirect when the destination is a prerendered route, and the output is set to "server".
#14169f4e8889 Thanks @ascorbic! - Fixes a bug that prevented images from being displayed in dev when using the Netlify adapter with trailingSlash set to always
#1405919f53eb Thanks @benosmac! - Fixes a bug in i18n implementation, where Astro didn’t emit the correct pages when fallback is enabled, and a locale uses a catch-all route, e.g. src/pages/es/[...catchAll].astro
#1415531822c3 Thanks @ascorbic! - Fixes a bug that caused an error “serverEntrypointModule[_start] is not a function” in some adapters
#14031e9206c1 Thanks @jp-knj! - Optimized the build pipeline for SVG images. Now, Astro doesn’t reprocess images that have already been processed.
#14132976879a Thanks @ematipico! - Fixes a bug where the property Astro.routePattern/context.routePattern wasn’t updated when using a rewrite via middleware.
#14131aafc4d7 Thanks @florian-lefebvre! - Fixes a case where an error occurring in a middleware would show the dev overlay instead of the custom 500.astro page
#1411914807a4 Thanks @ascorbic! - Fixes a bug that caused builds to fail if a client directive was mistakenly added to an Astro component
#140014b03d9c Thanks @dnek! - Fixes an issue where getImage() assigned the resized base URL to the srcset URL of ImageTransform, which matched the width, height, and format of the original image.
#13971fe35ee2 Thanks @adamhl8! - Adds an experimental flag rawEnvValues to disable coercion of import.meta.env values (e.g. converting strings to other data types) that are populated from process.env
However, Astro also converts your environment variables used through import.meta.env in some cases, and this can prevent access to some values such as the strings "true" (which is converted to a boolean value), and "1" (which is converted to a number).
The experimental.rawEnvValues flag disables coercion of import.meta.env values that are populated from process.env, allowing you to use the raw value.
To enable this feature, add the experimental flag in your Astro config:
import { defineConfig } from "astro/config"
export default defineConfig({
experimental: {
rawEnvValues: true,
}
})
If you were relying on this coercion, you may need to update your project code to apply it manually:
#139416bd5f75 Thanks @aditsachde! - Adds support for TOML files to Astro’s built-in glob() and file() content loaders.
In Astro 5.2, Astro added support for using TOML frontmatter in Markdown files instead of YAML. However, if you wanted to use TOML files as local content collection entries themselves, you needed to write your own loader.
Astro 5.12 now directly supports loading data from TOML files in content collections in both the glob() and the file() loaders.
If you had added your own TOML content parser for the file() loader, you can now remove it as this functionality is now included:
Note that TOML does not support top-level arrays. Instead, the file() loader considers each top-level table to be an independent entry. The table header is populated in the id field of the entry object.
#140453276b79 Thanks @ghubo! - Fixes a problem where importing animated .avif files returns a NoImageMetadata error.
#140410c4d5f8 Thanks @dixslyf! - Fixes a <ClientRouter /> bug where the fallback view transition animations when exiting a page
ran too early for browsers that do not support the View Transition API.
This bug prevented event.viewTransition?.skipTransition() from skipping the page exit animation
when used in an astro:before-swap event hook.
#13972db8f8be Thanks @ematipico! - Updates the NodeApp.match() function in the Adapter API to accept a second, optional parameter to allow adapter authors to add headers to static, prerendered pages.
NodeApp.match(request) currently checks whether there is a route that matches the given Request. If there is a prerendered route, the function returns undefined, because static routes are already rendered and their headers cannot be updated.
When the new, optional boolean parameter is passed (e.g. NodeApp.match(request, true)), Astro will return the first matched route, even when it’s a prerendered route. This allows your adapter to now access static routes and provides the opportunity to set headers for these pages, for example, to implement a Content Security Policy (CSP).
🐞 Patch Changes
#1402942562f9 Thanks @ematipico! - Fixes a bug where server islands wouldn’t be correctly rendered when they are rendered inside fragments.
Now the following examples work as expected:
---
import { Cart } from'../components/Cart.astro';
---
<>
<Cartserver:defer />
</>
<Fragmentslot="rest">
<Cartserver:defer>
<divslot="fallback">Not working</div>
</Cart>
</Fragment>
#140178d238bc Thanks @dmgawel! - Fixes a bug where i18n fallback rewrites didn’t work in dynamic pages.
#140003cbedae Thanks @feelixe! - Fix routePattern JSDoc examples to show correct return values
#13990de6cfd6 Thanks @isVivek99! - Fixes a case where astro:config/client and astro:config/server virtual modules would not contain config passed to integrations updateConfig() during the build
#14019a160d1e Thanks @ascorbic! - Removes the requirement to set type: 'live' when defining experimental live content collections
Previously, live collections required a type and loader configured. Now, Astro can determine that your collection is a live collection without defining it explicitly.
This means it is now safe to remove type: 'live' from your collections defined in src/live.config.ts:
import { defineLiveCollection } from 'astro:content';
import { storeLoader } from '@mystore/astro-loader';
const products = defineLiveCollection({
type: 'live',
loader: storeLoader({
apiKey: process.env.STORE_API_KEY,
endpoint: 'https://api.mystore.com/v1',
}),
});
export const collections = { products };
This is not a breaking change: your existing live collections will continue to work even if you still include type: 'live'. However, we suggest removing this line at your earliest convenience for future compatibility when the feature becomes stable and this config option may be removed entirely.
#13966598da21 Thanks @msamoylov! - Fixes a broken link on the default 404 page in development
#13988609044c Thanks @ascorbic! - Fixes a bug in live collections that caused it to incorrectly complain about the collection being defined in the wrong file
#13909b258d86 Thanks @isVivek99! - Fixes rendering of special boolean attributes for custom elements
#13983e718375 Thanks @florian-lefebvre! - Fixes a case where the toolbar audit would incorrectly flag images processed by Astro in content collections documents
#13999f077b68 Thanks @ascorbic! - Adds lastModified field to experimental live collection cache hints
Live loaders can now set a lastModified field in the cache hints for entries and collections to indicate when the data was last modified. This is then available in the cacheHint field returned by getCollection and getEntry.
#1398708f34b1 Thanks @ematipico! - Adds an informative message in dev mode when the CSP feature is enabled.
#1400582aad62 Thanks @ematipico! - Fixes a bug where inline styles and scripts didn’t work when CSP was enabled. Now when adding <styles> elements inside an Astro component, their hashes care correctly computed.
#13917e615216 Thanks @ascorbic! - Adds a new priority attribute for Astro’s image components.
This change introduces a new priority option for the <Image /> and <Picture /> components, which automatically sets the loading, decoding, and fetchpriority attributes to their optimal values for above-the-fold images which should be loaded immediately.
It is a boolean prop, and you can use the shorthand syntax by simply adding priority as a prop to the <Image /> or <Picture /> component. When set, it will apply the following attributes:
loading="eager"
decoding="sync"
fetchpriority="high"
The individual attributes can still be set manually if you need to customize your images further.
By default, the Astro <Image /> component generates <img> tags that lazy-load their content by setting loading="lazy" and decoding="async". This improves performance by deferring the loading of images that are not immediately visible in the viewport, and gives the best scores in performance audits like Lighthouse.
The new priority attribute will override those defaults and automatically add the best settings for your high-priority assets.
This option was previously available for experimental responsive images, but now it is a standard feature for all images.
<Imagesrc="/path/to/image.jpg"alt="An example image"priority />
[!Note]
You should only use the priority option for images that are critical to the initial rendering of the page, and ideally only one image per page. This is often an image identified as the LCP element when running Lighthouse tests. Using it for too many images will lead to performance issues, as it forces the browser to load those images immediately, potentially blocking the rendering of other content.
#13917e615216 Thanks @ascorbic! - The responsive images feature introduced behind a flag in v5.0.0 is no longer experimental and is available for general use.
The new responsive images feature in Astro automatically generates optimized images for different screen sizes and resolutions, and applies the correct attributes to ensure that images are displayed correctly on all devices.
Enable the image.responsiveStyles option in your Astro config. Then, set a layout attribute on any or component, or configure a default image.layout, for instantly responsive images with automatically generated srcset and sizes attributes based on the image’s dimensions and the layout type.
Displaying images correctly on the web can be challenging, and is one of the most common performance issues seen in sites. This new feature simplifies the most challenging part of the process: serving your site visitor an image optimized for their viewing experience, and for your website’s performance.
The experimental.responsiveImages flag has been removed, and all experimental image configuration options have been renamed to their final names.
If you were using the experimental responsive images feature, you’ll need to update your configuration:
Remove the experimental flag
export default defineConfig({
experimental: {
responsiveImages: true,
},
});
Update image configuration options
During the experimental phase, default styles were applied automatically to responsive images. Now, you need to explicitly set the responsiveStyles option to true if you want these styles applied.
export default defineConfig({
image: {
responsiveStyles: true,
},
});
The experimental image configuration options have been renamed:
responsiveStyles: true, // This is now *false* by default
},
});
Component usage remains the same
The layout, fit, and position props on <Image> and <Picture> components work exactly the same as before:
<Image
src={myImage}
alt="A responsive image"
layout="constrained"
fit="cover"
position="center"
/>
If you weren’t using the experimental responsive images feature, no changes are required.
Please see the Image guide for more information on using responsive images in Astro.
#136853c04c1f Thanks @ascorbic! - Adds experimental support for live content collections
Live content collections are a new type of content collection that fetch their data at runtime rather than build time. This allows you to access frequently-updated data from CMSs, APIs, databases, or other sources using a unified API, without needing to rebuild your site when the data changes.
In Astro 5.0, the content layer API added support for adding diverse content sources to content collections. You can create loaders that fetch data from any source at build time, and then access it inside a page via getEntry() and getCollection(). The data is cached between builds, giving fast access and updates.
However there is no method for updating the data store between builds, meaning any updates to the data need a full site deploy, even if the pages are rendered on-demand. This means that content collections are not suitable for pages that update frequently. Instead, today these pages tend to access the APIs directly in the frontmatter. This works, but leads to a lot of boilerplate, and means users don’t benefit from the simple, unified API that content loaders offer. In most cases users tend to individually create loader libraries that they share between pages.
Live content collections solve this problem by allowing you to create loaders that fetch data at runtime, rather than build time. This means that the data is always up-to-date, without needing to rebuild the site.
To enable live collections add the experimental.liveContentCollections flag to your astro.config.mjs file:
astro.config.mjs
{
experimental: {
liveContentCollections: true,
},
}
Then create a new src/live.config.ts file (alongside your src/content.config.ts if you have one) to define your live collections with a live loader and optionally a schema using the new defineLiveCollection() function from the astro:content module.
#13957304df34 Thanks @ematipico! - Fixes an issue where report-uri wasn’t available in experimental.csp.directives, causing a typing error and a runtime validation error.
#13957304df34 Thanks @ematipico! - Fixes a type error for the CSP directives upgrade-insecure-requests, sandbox, and trusted-type.
#13862fe8f61a Thanks @florian-lefebvre! - Fixes a case where the dev toolbar would crash if it could not retrieve some essential data
#139760a31d99 Thanks @florian-lefebvre! - Fixes a case where Astro Actions types would be broken when using a tsconfig.json with "moduleResolution": "nodenext"
#13923a9ac5ed Thanks @ematipico! - BREAKING CHANGE to the experimental Content Security Policy (CSP) only
Changes the behavior of experimental Content Security Policy (CSP) to now serve hashes differently depending on whether or not a page is prerendered:
Via the <meta> element for static pages.
Via the Response header content-security-policy for on-demand rendered pages.
This new strategy allows you to add CSP content that is not supported in a <meta> element (e.g. report-uri, frame-ancestors, and sandbox directives) to on-demand rendered pages.
No change to your project code is required as this is an implementation detail. However, this will result in a different HTML output for pages that are rendered on demand. Please check your production site to verify that CSP is working as intended.
To keep up to date with this developing feature, or to leave feedback, visit the CSP Roadmap proposal.
#13926953a249 Thanks @ematipico! - Adds a new Astro Adapter Feature called experimentalStaticHeaders to allow your adapter to receive the Headers for rendered static pages.
Adapters that enable support for this feature can access header values directly, affecting their handling of some Astro features such as Content Security Policy (CSP). For example, Astro will no longer serve the CSP <meta http-equiv="content-security-policy"> element in static pages to adapters with this support.
Astro will serve the value of the header inside a map that can be retrieved from the hook astro:build:generated. Adapters can read this mapping and use their hosting headers capabilities to create a configuration file.
A new field called experimentalRouteToHeaders will contain a map of Map<IntegrationResolvedRoute, Headers> where the Headers type contains the headers emitted by the rendered static route.
To enable support for this experimental Astro Adapter Feature, add it to your adapterFeatures in your adapter config:
See the Adapter API docs for more information about providing adapter features.
#13697af83b85 Thanks @benosmac! - Fixes issues with fallback route pattern matching when i18n.routing.fallbackType is rewrite.
Adds conditions for route matching in generatePath when building fallback routes and checking for existing translated pages
Now for a route to be matched it needs to be inside a named [locale] folder. This fixes an issue where route.pattern.test() incorrectly matched dynamic routes, causing the page to be skipped.
Adds conditions for route matching in findRouteToRewrite
Now the requested pathname must exist in route.distURL for a dynamic route to match. This fixes an issue where route.pattern.test() incorrectly matched dynamic routes, causing the build to fail.
#139241cd8c3b Thanks @qw-in! - Fixes an edge case where isPrerendered was incorrectly set to false for static redirects.
#13926953a249 Thanks @ematipico! - Fixes an issue where the experimental CSP meta element wasn’t placed in the <head> element as early as possible, causing these policies to not apply to styles and scripts that came before the meta element.
#13919423fe60 Thanks @ematipico! - Fixes a bug where Astro added quotes to the CSP resources.
Only certain resources require quotes (e.g. 'self' but not https://cdn.example.com), so Astro no longer adds quotes to any resources. You must now provide the quotes yourself for resources such as 'self' when necessary:
export default defineConfig({
experimental: {
csp: {
styleDirective: {
resources: [
"self",
"'self'",
"https://cdn.example.com"
]
}
}
}
})
#1391476c5480 Thanks @ematipico! - BREAKING CHANGE to the experimental Content Security Policy feature only
Removes support for experimental Content Security Policy (CSP) when using the <ClientRouter /> component for view transitions.
It is no longer possible to enable experimental CSP while using Astro’s view transitions. Support was already unstable with the <ClientRouter /> because CSP required making its underlying implementation asynchronous. This caused breaking changes for several users and therefore, this PR removes support completely.
If you are currently using the component for view transitions, please remove the experimental CSP flag as they cannot be used together.
import { defineConfig } from 'astro/config';
export default defineConfig({
experimental: {
csp: true
}
});
Alternatively, to continue using experimental CSP in your project, you can consider migrating to the browser native View Transition API and remove the <ClientRouter /> from your project. You may be able to achieve similar results if you are not using Astro’s enhancements to the native View Transitions and Navigation APIs.
Support might be reintroduced in future releases. You can follow this experimental feature’s development in the CSP RFC.
CSP is an important feature to provide fine-grained control over resources that can or cannot be downloaded and executed by a document. In particular, it can help protect against cross-site scripting (XSS) attacks.
Enabling this feature adds additional security to Astro’s handling of processed and bundled scripts and styles by default, and allows you to further configure these, and additional, content types. This new experimental feature has been designed to work in every Astro rendering environment (static pages, dynamic pages and single page applications), while giving you maximum flexibility and with type-safety in mind.
It is compatible with most of Astro’s features such as client islands, and server islands, although Astro’s view transitions using the <ClientRouter /> are not yet fully supported. Inline scripts are not supported out of the box, but you can provide your own hashes for external and inline scripts.
To enable this feature, add the experimental flag in your Astro config:
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
csp: true,
},
});
For more information on enabling and using this feature in your project, see the Experimental CSP docs.
For a complete overview, and to give feedback on this experimental API, see the Content Security Policy RFC.
When creating a content loader, you will now have access to a renderMarkdown function that allows you to render Markdown content directly within your loaders. It uses the same settings and plugins as the renderer used for Markdown files in Astro, and follows any Markdown settings you have configured in your Astro project.
This allows you to render Markdown content from various sources, such as a CMS or other data sources, directly in your loaders without needing to preprocess the Markdown content separately.
importtype { Loader } from'astro/loaders';
import { loadFromCMS } from'./cms';
exportfunctionmyLoader(settings):Loader {
return {
name: 'my-loader',
asyncload({ renderMarkdown, store }) {
constentries=awaitloadFromCMS();
store.clear();
for (constentryof entries) {
// Assume each entry has a 'content' field with markdown content
store.set(entry.id, {
id: entry.id,
data: entry,
rendered: awaitrenderMarkdown(entry.content),
});
}
},
};
}
The return value of renderMarkdown is an object with two properties: html and metadata. These match the rendered property of content entries in content collections, so you can use them to render the content in your components or pages.
#1388762f0668 Thanks @yanthomasdev! - Adds an option for integration authors to suppress adapter warning/errors in supportedAstroFeatures. This is useful when either an warning/error isn’t applicable in a specific context or the default one might conflict and confuse users.
To do so, you can add suppress: "all" (to suppress both the default and custom message) or suppress: "default" (to only suppress the default one):
setAdapter({
name: 'my-astro-integration',
supportedAstroFeatures: {
staticOutput: 'stable',
hybridOutput: 'stable',
sharpImageService: {
support: 'limited',
message:
"The sharp image service isn't available in the deploy environment, but will be used by prerendered pages on build.",
This change adds a new image.experimentalDefaultStyles option that allows you to disable the default styles applied to responsive images.
When using experimental responsive images, Astro applies default styles to ensure the images resize correctly. In most cases this is what you want – and they are applied with low specificity so your own styles override them. However in some cases you may want to disable these default styles entirely. This is particularly useful when using Tailwind 4, because it uses CSS cascade layers to apply styles, making it difficult to override the default styles.
image.experimentalDefaultStyles is a boolean option that defaults to true, so you can change it in your Astro config file like this:
Node.js 18 has now reached end-of-life and should not be used. For now, Astro will continue to support Node.js 18.20.8, which is the final LTS release of Node.js 18, as well as Node.js 20 and Node.js 22 or later. We will drop support for Node.js 18 in a future release, so we recommend upgrading to Node.js 22 as soon as possible. See Astro’s Node.js support policy for more details.
:warning: Important note for users of Cloudflare Pages: The current build image for Cloudflare Pages uses Node.js 18.17.1 by default, which is no longer supported by Astro. If you are using Cloudflare Pages you should override the default Node.js version to Node.js 22. This does not affect users of Cloudflare Workers, which uses Node.js 22 by default.
#1337350ef568 Thanks @jpwienekus! - Fixes a bug where highlights and tooltips render over the audit list window.
#13769e9fc456 Thanks @romanstetsyk! - Expand ActionError codes to include all IANA-registered HTTP error codes.
#13668866285a Thanks @sapphi-red! - Replaces internal CSS chunking behavior for Astro components’ scoped styles to use Vite’s cssScopeTo feature. The feature is a port of Astro’s implementation so this should not change the behavior.
#137887d0b7ac Thanks @florian-lefebvre! - Fixes a case where an error would not be thrown when using the <Font /> component from the experimental fonts API without adding fonts in the Astro config
#13784d7a1889 Thanks @florian-lefebvre! - Fixes the experimental fonts API to correctly take config.base, config.build.assets and config.build.assetsPrefix into account
#13777a56b8ea Thanks @L4Ph! - Fixed an issue where looping GIF animation would stop when converted to WebP
#13752a079c21 Thanks @florian-lefebvre! - Improves handling of font URLs not ending with a file extension when using the experimental fonts API
#137507d3127d Thanks @martrapp! - Allows the ClientRouter to open new tabs or windows when submitting forms by clicking while holding the Cmd, Ctrl, or Shift key.
#13765d874fe0 Thanks @florian-lefebvre! - Fixes a case where font sources with relative protocol URLs would fail when using the experimental fonts API
#136405e582e7 Thanks @florian-lefebvre! - Allows inferring weight and style when using the local provider of the experimental fonts API
If you want Astro to infer those properties directly from your local font files, leave them undefined:
#137515816b8a Thanks @florian-lefebvre! - Updates unifont to support subsets when using the google provider with the experimental fonts API
#13756d4547ba Thanks @florian-lefebvre! - Adds a terminal warning when a remote provider returns no data for a family when using the experimental fonts API
#13742f599463 Thanks @florian-lefebvre! - Fixes optimized fallback css generation to properly add a src when using the experimental fonts API
#137406935540 Thanks @vixalien! - Fix cookies set after middleware did a rewrite with next(url) not being applied
#137594a56d0a Thanks @jp-knj! - Improved the error handling of certain error cases.
#13715b32dffa Thanks @florian-lefebvre! - Updates unifont to fix a case where a unicodeRange related error would be thrown when using the experimental fonts API
#1370528f8716 Thanks @florian-lefebvre! - Updates unifont to latest and adds support for fetch options from remote providers when using the experimental fonts API
#1369260d5be4 Thanks @Le0Developer! - Fixes a bug where Astro couldn’t probably use inferSize for images that contain apostrophe ' in their name.
#13698ab98f88 Thanks @sarah11918! - Improves the configuration reference docs for the adapter entry with more relevant text and links.
#13653a7b2dc6 Thanks @florian-lefebvre! - Reduces the amount of preloaded files for the local provider when using the experimental fonts API
#13653a7b2dc6 Thanks @florian-lefebvre! - Fixes a case where invalid CSS was emitted when using an experimental fonts API family name containing a space
#13703659904b Thanks @florian-lefebvre! - Fixes a bug where empty fallbacks could not be provided when using the experimental fonts API
#1368018e1b97 Thanks @florian-lefebvre! - Improves the UnsupportedExternalRedirect error message to include more details such as the concerned destination
:warning: BREAKING CHANGE FOR EXPERIMENTAL RESPONSIVE IMAGES ONLY :warning:
The generated styles for image layouts are now simpler and easier to override. Previously the responsive image component used CSS to set the size and aspect ratio of the images, but this is no longer needed. Now the styles just include object-fit and object-position for all images, and sets max-width: 100% for constrained images and width: 100% for full-width images.
This is an implementation change only, and most users will see no change. However, it may affect any custom styles you have added to your responsive images. Please check your rendered images to determine whether any change to your CSS is needed.
The styles now use the :where() pseudo-class, which has a specificity of 0, meaning that it is easy to override with your own styles. You can now be sure that your own classes will always override the applied styles, as will global styles on img.
An exception is Tailwind 4, which uses cascade layers, meaning the rules are always lower specificity. Astro supports browsers that do not support cascade layers, so we cannot use this. If you need to override the styles using Tailwind 4, you must use !important classes. Do check if this is needed though: there may be a layout that is more appropriate for your use case.
#13703659904b Thanks @ascorbic! - Adds warnings about using local font files in the publicDir when the experimental fonts API is enabled.
#13703659904b Thanks @ascorbic! - Renames experimental responsive image layout option from “responsive” to “constrained”
:warning: BREAKING CHANGE FOR EXPERIMENTAL RESPONSIVE IMAGES ONLY :warning:
The layout option called "responsive" is renamed to "constrained" to better reflect its behavior.
The previous name was causing confusion, because it is also the name of the feature. The responsive layout option is specifically for images that are displayed at the requested size, unless they do not fit the width of their container, at which point they would be scaled down to fit. They do not get scaled beyond the intrinsic size of the source image, or the width prop if provided.
It became clear from user feedback that many people (understandably) thought that they needed to set layout to responsive if they wanted to use responsive images. They then struggled with overriding styles to make the image scale up for full-width hero images, for example, when they should have been using full-width layout. Renaming the layout to constrained should make it clearer that this layout is for when you want to constrain the maximum size of the image, but allow it to scale-down.
Upgrading
If you set a default image.experimentalLayout in your astro.config.mjs, or set it on a per-image basis using the layout prop, you will need to change all occurences to constrained:
astro.config.mjs
exportdefault {
image: {
experimentalLayout: 'responsive',
experimentalLayout: 'constrained',
},
}
src/pages/index.astro
---
import { Image } from'astro:assets';
---
<Imagesrc="/image.jpg"layout="responsive" />
<Imagesrc="/image.jpg"layout="constrained" />
Please give feedback on the RFC if you have any questions or comments about the responsive images API.
#1366973f24d4 Thanks @ematipico! - Fixes an issue where Astro.originPathname wasn’t returning the correct value when using rewrites.
#1367442388b2 Thanks @florian-lefebvre! - Fixes a case where an experimental fonts API error would be thrown when using another astro:assets API
#136544931457 Thanks @florian-lefebvre! - Fixes fontProviders.google() so it can forward options to the unifont provider, when using the experimental fonts API
#1364367b7493 Thanks @tanishqmanuja! - Fixes a case where the font face src format would be invalid when using the experimental fonts API
#1363923410c6 Thanks @florian-lefebvre! - Fixes a case where some font families would not be downloaded when using the same font provider several times, using the experimental fonts API
#135272fd6a6b Thanks @ascorbic! - The experimental session API introduced in Astro 5.1 is now stable and ready for production use.
Sessions are used to store user state between requests for on-demand rendered pages. You can use them to store user data, such as authentication tokens, shopping cart contents, or any other data that needs to persist across requests:
---
exportconstprerender=false; // Not needed with 'server' output
constcart=await Astro.session.get('cart');
---
<ahref="/checkout">🛒 {cart?.length??0} items</a>
Configuring session storage
Sessions require a storage driver to store the data. The Node, Cloudflare and Netlify adapters automatically configure a default driver for you, but other adapters currently require you to specify a custom storage driver in your configuration.
If you are using an adapter that doesn’t have a default driver, or if you want to choose a different driver, you can configure it using the session configuration option:
import { defineConfig } from'astro/config';
import vercel from'@astrojs/vercel';
exportdefaultdefineConfig({
adapter: vercel(),
session: {
driver: 'upstash',
},
});
Using sessions
Sessions are available in on-demand rendered pages, API endpoints, actions and middleware.
In pages and components, you can access the session using Astro.session:
---
constcart=await Astro.session.get('cart');
---
<ahref="/checkout">🛒 {cart?.length??0} items</a>
In endpoints, actions, and middleware, you can access the session using context.session:
exportasyncfunctionGET(context) {
constcart=await context.session.get('cart');
return Response.json({ cart });
}
If you attempt to access the session when there is no storage driver configured, or in a prerendered page, the session object will be undefined and an error will be logged in the console:
---
exportconstprerender=true;
constcart=await Astro.session?.get('cart'); // Logs an error. Astro.session is undefined
---
Upgrading from Experimental to Stable
If you were previously using the experimental API, please remove the experimental.session flag from your configuration:
#12775b1fe521 Thanks @florian-lefebvre! - Adds a new, experimental Fonts API to provide first-party support for fonts in Astro.
This experimental feature allows you to use fonts from both your file system and several built-in supported providers (e.g. Google, Fontsource, Bunny) through a unified API. Keep your site performant thanks to sensible defaults and automatic optimizations including fallback font generation.
To enable this feature, configure an experimental.fonts object with one or more fonts:
Then, add a <Font /> component and site-wide styling in your <head>:
src/components/Head.astro
---
import { Font } from'astro:assets';
---
<FontcssVariable="--font-roboto"preload />
<style>
body {
font-family: var(--font-roboto);
}
</style>
Visit the experimental Fonts documentation for the full API, how to get started, and even how to build your own custom AstroFontProvider if we don’t yet support your preferred font service.
For a complete overview, and to give feedback on this experimental API, see the Fonts RFC and help shape its future.
#13560df3fd54 Thanks @ematipico! - The virtual module astro:config introduced behind a flag in v5.2.0 is no longer experimental and is available for general use.
This virtual module exposes two sub-paths for type-safe, controlled access to your configuration:
astro:config/client: exposes config information that is safe to expose to the client.
astro:config/server: exposes additional information that is safe to expose to the server, such as file and directory paths.
Access these in any file inside your project to import and use select values from your Astro config:
If you have been waiting for stabilization before using the SVG Components feature, you can now do so.
If you were previously using this feature, please remove the experimental flag from your Astro config:
import { defineConfig } from 'astro'
export default defineConfig({
experimental: {
svg: true,
}
})
Additionally, a few features that were available during the experimental stage were removed in a previous release. Please see the v5.6.0 changelog for details if you have not yet already updated your project code for the experimental feature accordingly.
#136023213450 Thanks @natemoo-re! - Updates the Audit dev toolbar app to automatically strip data-astro-source-file and data-astro-source-loc attributes in dev mode.
#13598f5de51e Thanks @dreyfus92! - Fix routing with base paths when trailingSlash is set to ‘never’. This ensures requests to ‘/base’ are correctly matched when the base path is set to ‘/base’, without requiring a trailing slash.
#13603d038030 Thanks @sarah11918! - Adds the minimal starter template to the list of create astro options
Good news if you’re taking the introductory tutorial in docs, making a minimal reproduction, or just want to start a project with as little to rip out as possible. Astro’s minimal (empty) template is now back as one of the options when running create astro@latest and starting a new project!
#135895a0563d Thanks @ematipico! - Deprecates the asset utility function emitESMImage() and adds a new emitImageMetadata() to be used instead
The function
emitESMImage() is now deprecated. It will continue to function, but it is no longer recommended nor supported. This function will be completely removed in a next major release of Astro.
Please replace it with the new functionemitImageMetadata() as soon as you are able to do so:
import { emitESMImage } from "astro/assets/utils";
import { emitImageMetadata } from "astro/assets/utils";
The new function returns the same signature as the previous one. However, the new function removes two deprecated arguments that were not meant to be exposed for public use: _watchMode and experimentalSvgEnabled. Since it was possible to access these with the old function, you may need to verify that your code still works as intended with emitImageMetadata().
Deno requires npm prefix to install packages on npm. For example, to install react, we need to run deno add npm:react. But currently the command executed is deno add react, which doesn’t work. So, we change the package names to have an npm prefix if you are using Deno.
#13587a0774b3 Thanks @robertoms99! - Fixes an issue with the client router where some attributes of the root element were not updated during swap, including the transition scope.
#13545a7aff41 Thanks @stramel! - Prevent empty attributes from appearing in the SVG output
#135529cd0fd4 Thanks @ematipico! - Fixes an issue where Astro validated the i18n configuration incorrectly, causing false positives in downstream libraries.
#13403dcb9526 Thanks @yurynix! - Adds a new optional prerenderedErrorPageFetch option in the Adapter API to allow adapters to provide custom implementations for fetching prerendered error pages.
Now, adapters can override the default fetch() behavior, for example when fetch() is unavailable or when you cannot call the server from itself.
The following example provides a custom fetch for 500.html and 404.html, reading them from disk instead of performing an HTTP call:
#13482ff257df Thanks @florian-lefebvre! - Updates Astro config validation to also run for the Integration API. An error log will specify which integration is failing the validation.
Now, Astro will first validate the user configuration, then validate the updated configuration after each integration astro:config:setup hook has run. This means updateConfig() calls will no longer accept invalid configuration.
This fixes a situation where integrations could potentially update a project with a malformed configuration. These issues should now be caught and logged so that you can update your integration to only set valid configurations.
#1340521e7e80 Thanks @Marocco2! - Adds a new eagerness option for prefetch() when using experimental.clientPrerender
With the experimental clientPrerender flag enabled, you can use the eagerness option on prefetch() to suggest to the browser how eagerly it should prefetch/prerender link targets.
This follows the same API described in the Speculation Rules API and allows you to balance the benefit of reduced wait times against bandwidth, memory, and CPU costs for your site visitors.
For example, you can now use prefetch() programmatically with large sets of links and avoid browser limits in place to guard against over-speculating (prerendering/prefetching too many links). Set eagerness: 'moderate' to take advantage of First In, First Out (FIFO) strategies and browser heuristics to let the browser decide when to prerender/prefetch them and in what order:
<aclass="link-moderate"href="/nice-link-1">A Nice Link 1</a>
<aclass="link-moderate"href="/nice-link-2">A Nice Link 2</a>
<aclass="link-moderate"href="/nice-link-3">A Nice Link 3</a>
<aclass="link-moderate"href="/nice-link-4">A Nice Link 4</a>
...
<aclass="link-moderate"href="/nice-link-20">A Nice Link 20</a>
If an error is thrown from an integration hook, an error log will now provide information about the concerned integration and hook
🐞 Patch Changes
#13539c43bf8c Thanks @ascorbic! - Adds a new session.load() method to the experimental session API that allows you to load a session by ID.
When using the experimental sessions API, you don’t normally need to worry about managing the session ID and cookies: Astro automatically reads the user’s cookies and loads the correct session when needed. However, sometimes you need more control over which session to load.
The new load() method allows you to manually load a session by ID. This is useful if you are handling the session ID yourself, or if you want to keep track of a session without using cookies. For example, you might want to restore a session from a logged-in user on another device, or work with an API endpoint that doesn’t use cookies.
#13488d777420 Thanks @stramel! - BREAKING CHANGE to the experimental SVG Component API only
Removes some previously available prop, attribute, and configuration options from the experimental SVG API. These items are no longer available and must be removed from your code:
The title prop has been removed until we can settle on the correct balance between developer experience and accessibility. Please replace any title props on your components with aria-label:
<Logo title="My Company Logo" />
<Logo aria-label="My Company Logo" />
Sprite mode has been temporarily removed while we consider a new implementation that addresses how this feature was being used in practice. This means that there are no longer multiple mode options, and all SVGs will be inline. All instances of mode must be removed from your project as you can no longer control a mode:
<Logo mode="inline" />
<Logo />
import { defineConfig } from 'astro'
export default defineConfig({
experimental: {
svg: {
mode: 'sprite'
},
svg: true
}
});
The default role is no longer applied due to developer feedback. Please add the appropriate role on each component individually as needed:
<Logo />
<Logo role="img" /> // To keep the role that was previously applied by default
The size prop has been removed to better work in combination with viewBox and additional styles/attributes. Please replace size with explicit width and height attributes:
#1342906de673 Thanks @ematipico! - The ActionAPIContext.rewrite method is deprecated and will be removed in a future major version of Astro
#1352482cd583 Thanks @ematipico! - Fixes a bug where the functions Astro.preferredLocale and Astro.preferredLocaleList would return the incorrect locales
when the Astro configuration specifies a list of codes. Before, the functions would return the path, instead now the functions
return a list built from codes.
#13483fc2dcb8 Thanks @ematipico! - Fixes a bug where an Astro adapter couldn’t call the middleware when there isn’t a route that matches the incoming request.
#133727783dbf Thanks @ascorbic! - Fixes a bug that caused some very large data stores to save incomplete data.
#133588c21663 Thanks @ematipico! - Adds a new function called insertPageRoute to the Astro Container API.
The new function is useful when testing routes that, for some business logic, use Astro.rewrite.
For example, if you have a route /blog/post and for some business decision there’s a rewrite to /generic-error, the container API implementation will look like this:
console.log(result); // this should print the response from GenericError.astro
This new method only works for page routes, which means that endpoints aren’t supported.
#13426565583b Thanks @ascorbic! - Fixes a bug that caused the astro add command to ignore the --yes flag for third-party integrations
#134289cac9f3 Thanks @matthewp! - Prevent bad value in x-forwarded-host from crashing request
#13432defad33 Thanks @P4tt4te! - Fix an issue in the Container API, where the renderToString function doesn’t render adequately nested slots when they are components.
#13415be866a1 Thanks @ascorbic! - Reuses experimental session storage object between requests. This prevents memory leaks and improves performance for drivers that open persistent connections to a database.
#134202f039b9 Thanks @ematipico! - It fixes an issue that caused some regressions in how styles are bundled.
#134023e7b498 Thanks @ematipico! - Adds a new experimental flag called experimental.preserveScriptOrder that renders <script> and <style> tags in the same order as they are defined.
When rendering multiple <style> and <script> tags on the same page, Astro currently reverses their order in your generated HTML output. This can give unexpected results, for example CSS styles being overridden by earlier defined style tags when your site is built.
With the new preserveScriptOrder flag enabled, Astro will generate the styles in the order they are defined:
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
preserveScriptOrder: true,
},
});
For example, the following component has two <style> tags, and both define the same style for the body tag:
<p>I am a component</p>
<style>
body {
background: red;
}
</style>
<style>
body {
background: yellow;
}
</style>
Once the project is compiled, Astro will create an inline style where yellow appears first, and then red. Ultimately, the red background is applied:
body {
background: #ff0;
}
body {
background: red;
}
When experimental.preserveScriptOrder is set to true, the order of the two styles is kept as it is, and in the style generated red appears first, and then yellow:
body {
background: red;
}
body {
background: #ff0;
}
This is a breaking change to how Astro renders project code that contains multiple <style> and <script> tags in the same component. If you were previously compensating for Astro’s behavior by writing these out of order, you will need to update your code.
This will eventually become the new default Astro behavior, so we encourage you to add this experimental style and script ordering as soon as you are able! This will help us test the new behavior and ensure your code is ready when this becomes the new normal.
#13352cb886dc Thanks @delucis! - Adds support for a new experimental.headingIdCompat flag
By default, Astro removes a trailing - from the end of IDs it generates for headings ending with
special characters. This differs from the behavior of common Markdown processors.
You can now disable this behavior with a new configuration flag:
astro.config.mjs
import { defineConfig } from'astro/config';
exportdefaultdefineConfig({
experimental: {
headingIdCompat: true,
},
});
This can be useful when heading IDs and anchor links need to behave consistently across your site
and other platforms such as GitHub and npm.
#13311a3327ff Thanks @chrisirhc! - Adds a new configuration option for Markdown syntax highlighting excludeLangs
This option provides better support for diagramming tools that rely on Markdown code blocks, such as Mermaid.js and D2 by allowing you to exclude specific languages from Astro’s default syntax highlighting.
This option allows you to avoid rendering conflicts with tools that depend on the code not being highlighted without forcing you to disable syntax highlighting for other code blocks.
The following example configuration will exclude highlighting for mermaid and math code blocks:
#134044e78b4d Thanks @ascorbic! - Fixes a bug in error handling that saving a content file with a schema error would display an “unhandled rejection” error instead of the correct schema error
#13379d59eb22 Thanks @martrapp! - Fixes an edge case where the client router executed scripts twice when used with a custom swap function that only swaps parts of the DOM.
#133936b8fdb8 Thanks @renovate! - Updates primsjs to version 1.30.0, which adds support for more languages and fixes a security advisory which does not affect Astro.
#133747b75bc5 Thanks @ArmandPhilippot! - Fixes the documentation of the i18n configuration where manual was presented as a key of routing instead of an available value.
#133809bfa6e6 Thanks @martrapp! - Fixes an issue where astro:page-load fires before all scripts are executed
#13381249d52a Thanks @martrapp! - Adds the types property to the viewTransition object when the ClientRouter simulates parts of the View Transition API on browsers w/o native support.
#133673ce4ad9 Thanks @ematipico! - Adds documentation to various utility functions used for remote image services
#13347d83f92a Thanks @bluwy! - Updates internal CSS chunking behavior for Astro components’ scoped styles. This may result in slightly more CSS chunks created, but should allow the scoped styles to only be included on pages that use them.
#13388afadc70 Thanks @ematipico! - Fixes a bug where astro:config/server and astro:config/client had incorrect types.
#13355042d1de Thanks @ematipico! - Adds documentation to the assets utilities for remote service images.
#133956d1c63f Thanks @bluwy! - Uses package-manager-detector to detect the package manager used in the project
#13363a793636 Thanks @ematipico! - Fixes an issue where the internal function makeSvgComponent was incorrectly exposed as a public API.
#132620025df3 Thanks @ematipico! - Refactor Astro Actions to not use a middleware. Doing so should avoid unexpected issues when using the Astro middleware at the edge.
#133368f632ef Thanks @ematipico! - Fixes a regression where some asset utilities were move across monorepo, and not re-exported anymore.
#13320b5dabe9 Thanks @{! - Adds support for typing experimental session data
You can add optional types to your session data by creating a src/env.d.ts file in your project that extends the global App.SessionData interface. For example:
declarenamespaceApp {
interfaceSessionData {
id:string;
email:string;
};
lastLogin: Date;
}
}
Any keys not defined in this interface will be treated as any.
Then when you access Astro.session in your components, any defined keys will be typed correctly:
#133305e7646e Thanks @ematipico! - Fixes an issue with the conditional rendering of scripts.
This change updates a v5.0 breaking change when experimental.directRenderScript became the default script handling behavior.
If you have already successfully upgraded to Astro v5, you may need to review your script tags again and make sure they still behave as desired after this release. See the v5 Upgrade Guide for more details.
Two new helper functions exported from astro/config:
mergeConfig() allows users to merge partially defined Astro configurations on top of a base config while following the merge rules of updateConfig() available for integrations.
validateConfig() allows users to validate that a given value is a valid Astro configuration and fills in default values as necessary.
These helpers are particularly useful for integration authors and for developers writing scripts that need to manipulate Astro configurations programmatically.
Programmatic build
The build API now receives a second optional BuildOptions argument where users can specify:
devOutput (default false): output a development-based build similar to code transformed in astro dev.
teardownCompiler (default true): teardown the compiler WASM instance after build.
These options provide more control when running Astro builds programmatically, especially for testing scenarios or custom build pipelines.
#132784a43c4b Thanks @ematipico! - Adds a new configuration option server.allowedHosts and CLI option --allowed-hosts.
Now you can specify the hostnames that the dev and preview servers are allowed to respond to. This is useful for allowing additional subdomains, or running the dev server in a web container.
allowedHosts checks the Host header on HTTP requests from browsers and if it doesn’t match, it will reject the request to prevent CSRF and XSS attacks.
#132541e11f5e Thanks @p0lyw0lf! - Adds the ability to process and optimize remote images in Markdown files
Previously, Astro only allowed local images to be optimized when included using ![]() syntax in plain Markdown files. Astro’s image service could only display remote images without any processing.
Now, Astro’s image service can also optimize remote images written in standard Markdown syntax. This allows you to enjoy the benefits of Astro’s image processing when your images are stored externally, for example in a CMS or digital asset manager.
No additional configuration is required to use this feature! Any existing remote images written in Markdown will now automatically be optimized. To opt-out of this processing, write your images in Markdown using the HTML <img> tag instead. Note that images located in your public/ folder are still never processed.
🐞 Patch Changes
#13256509fa67 Thanks @p0lyw0lf! - Adds experimental responsive image support in Markdown
Previously, the experimental.responsiveImages feature could only provide responsive images when using the <Image /> and <Picture /> components.
Now, images written with the ![]() Markdown syntax in Markdown and MDX files will generate responsive images by default when using this experimental feature.
To try this experimental feature, set experimental.responsiveImages to true in your astro.config.mjs file:
For a complete overview, and to give feedback on this experimental API, see the Responsive Images RFC.
#1332380926fa Thanks @ematipico! - Updates esbuild and vite to the latest to avoid false positives audits warnings caused by esbuild.
#133139e7c71d Thanks @martrapp! - Fixes an issue where a form field named “attributes” shadows the form.attributes property.
#120525be12b2 Thanks @Fryuni! - Fixes incorrect config update when calling updateConfig from astro:build:setup hook.
The function previously called a custom update config function made for merging an Astro config. Now it calls the appropriate mergeConfig() utility exported by Vite that updates functional options correctly.
#133035f72a58 Thanks @ematipico! - Fixes an issue where the dev server was applying second decoding of the URL of the incoming request, causing issues for certain URLs.
#1323332fafeb Thanks @joshmkennedy! - Ensures that Astro.url/ctx.url is correctly updated with the base path after rewrites.
This change fixes an issue where Astro.url/ctx.url did not include the configured base path after Astro.rewrite was called. Now, the base path is correctly reflected in Astro.url.
Previously, any rewrites performed through Astro.rewrite/ctx.rewrite failed to append the base path to Astro.url/ctx.rewrite, which could lead to incorrect URL handling in downstream logic. By fixing this, we ensure that all routes remain consistent and predictable after a rewrite.
If you were relying on the work around of including the base path in astro.rewrite you can now remove it from the path.