惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
Security Latest
Security Latest
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
Engineering at Meta
Engineering at Meta
The Register - Security
The Register - Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
罗磊的独立博客
MyScale Blog
MyScale Blog
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
小众软件
小众软件
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
F
Fortinet All Blogs
博客园 - 叶小钗
H
Help Net Security
大猫的无限游戏
大猫的无限游戏
U
Unit 42
G
Google Developers Blog
V
Visual Studio Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
PCI Perspectives
PCI Perspectives
The Last Watchdog
The Last Watchdog
有赞技术团队
有赞技术团队
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News and Events Feed by Topic
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Application and Cybersecurity Blog
Application and Cybersecurity Blog
雷峰网
雷峰网
SecWiki News
SecWiki News
Google Online Security Blog
Google Online Security Blog
S
Security @ Cisco Blogs
N
News | PayPal Newsroom
The Hacker News
The Hacker News
月光博客
月光博客
T
Threatpost
B
Blog
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Simon Willison's Weblog
Simon Willison's Weblog
P
Palo Alto Networks Blog
L
LangChain Blog
Scott Helme
Scott Helme
Last Week in AI
Last Week in AI
C
Check Point Blog
P
Privacy International News Feed

The Astro Blog

Astro 6.4 Astro 6.3 Starlight 0.39 Astro 6.2 What's new in Astro - April 2026 What's new in Astro - March 2026 Astro 6.1 CloudCannon Joins Astro as an Official CMS Partner Astro 6.0 What's new in Astro - February 2026 What's new in Astro - January 2026 Astro 5.17 Supporting the future of Astro The Astro Technology Company joins Cloudflare Astro 6 Beta What's new in Astro - December 2025 What's new in Astro - November 2025 Astro 5.16 Stainless Sponsors Astro, Launches Astro-Powered Docs Platform What's new in Astro - October 2025 Astro 5.15 Spirit of Astro: meet the winning designs What's new in Astro - September 2025 Astro 5.14 Cloudflare Donates $150,000 to Support Astro's Open Source Mission Webflow Donates $150,000 to Support Astro's Open Source Mission Mux: Our Official Video Partner Unleashing creativity: How CodeTV built a video streaming platform with Astro and Mux | Astro What's new in Astro - August 2025 Astro 5.13 What's new in Astro - July 2025 Astro 5.12 Starlight 0.35 Astro 5.11 What's new in Astro - June 2025 Live Content Collections: A Deep Dive Introducing… Astro Mart Astro Solstice Festival Astro 5.10 Astro 5.9 What's new in Astro - May 2025 Astro 5.8 What's new in Astro - April 2025 2025 Technical Steering Committee Starlight April Update Astro 5.7 Astro Agency Partner Program Astro 5.6 What's new in Astro - March 2025 Astro 5.5 What's new in Astro - February 2025 Astro 5.4 Starlight 0.32 Astro 5.3 What's new in Astro - January 2025 Astro 5.2 2024 year in review What's new in Astro - December 2024 Astro 5.1 Astro 5.0 Google IDX: Our Official Online Editor Partner What's new in Astro - November 2024 What's new in Astro - October 2024 Astro x Cloudinary SDK What's new in Astro - September 2024 Community Loaders for Astro Content Layer Astro x Hygraph: Content Loader Astro x Cloudinary: Content Loader Astro x Storyblok: Content Loader Content Layer: A Deep Dive Starlight 0.28 Astro 5.0 Beta Release The $100,000 Astro Ecosystem Fund Fall Update Goodbye Studio, Hello DB What's new in Astro - August 2024 Astro 4.15 Astro 4.14 Astro 4.13 What's new in Astro - July 2024 Astro 4.12: Server Islands Netlify: Our Official Deployment Partner What's new in Astro - June 2024 Astro 4.11 Astro Together 2024 Server Islands The Astro Content Layer Zero-JavaScript View Transitions Astro 4.10 Starlight turns one year old! What's new in Astro - May 2024 Astro 4.9 Astro 4.8 What's new in Astro - April 2024 Astro 4.7 What's new in Astro - March 2024 Migrating 500+ tests from Mocha to Node.js Astro DB: A Deep Dive The Astro Developer Portal Astro DB Astro 4.5
Astro 4.6
Erika, Emanuele Stoppa, Matthew Phillips, Nate Moore, Bjorn Lu · 2024-04-11 · via The Astro Blog

After a short break post-launch week, Astro 4.6 is now here and we’re back to our regular schedule! This release includes a new manual routing strategy for internationalization, experimental support for CSRF protection, a new feature for the dev toolbar, and more.

Full release highlights include:

  • Manual i18n routing strategy
  • Ability to move the dev toolbar
  • Experimental: Support for CSRF protection
  • Cookies improvements
  • Deprecated support for older versions of Node.js

To upgrade an existing project, use the automated @astrojs/upgrade CLI tool. Alternatively, upgrade manually by running the upgrade command for your package manager:

# Recommended:

npx @astrojs/upgrade

# Manual:

npm install astro@latest

pnpm upgrade astro --latest

yarn upgrade astro --latest

Manual routing strategy for internationalization

Astro 4.6 introduces a manual routing strategy for internationalization. This new strategy allows you to take total control over the routing of your internationalized Astro website, for cases where the default routing strategy doesn’t quite meet your needs.

To enable manual routing, set the i18n.routing option in your astro.config.mjs to manual:

import { defineConfig } from "astro/config";

export default defineConfig({

i18n: {

locales: ["en", "fr"],

defaultLocale: "fr",

routing: "manual",

},

});

and then add a middleware to your project to handle the routing:

import { defineMiddleware } from "astro:middleware";

import { redirectToDefaultLocale } from "astro:i18n";

// Example middleware that redirects all requests to the default locale apart for the /about page

export const onRequest = defineMiddleware(async (context, next) => {

if (context.url.startsWith("/about")) {

return next();

} else {

return redirectToDefaultLocale(context, 302);

}

});

Alternatively, you can import Astro’s own middleware logic using the new middleware function from astro:i18n to build upon the default routing strategy:

import { defineMiddleware, sequence } from "astro:middleware";

import { middleware } from "astro:i18n"; // Astro's own i18n routing middleware

export const userMiddleware = defineMiddleware(() => {

// Your custom middleware logic here

});

export const onRequest = sequence(

userMiddleware,

middleware({

redirectToDefaultLocale: false,

prefixDefaultLocale: true

})

)

Check out the internationalization documentation for more information on how to use manual routing with internationalization.

Astro 4.6 introduces the ability to move the dev toolbar to different positions at the bottom of your screen. This can be useful if you have a sticky header that covers the bottom of the screen, or if you just prefer the toolbar to be somewhere else. The dev toolbar is there to help you, not get in your way! Thanks to Ming-jun Lu for contributing this requested feature!

Experimental: Support for CSRF protection

Astro 4.6 adds experimental partial support for CSRF protection. This feature is currently under an experimental flag and may change in future releases.

To enable it, set the experimental.security.csrfProtection option in your astro.config.mjs:

import { defineConfig } from "astro/config";

export default defineConfig({

experimental: {

security: {

csrfProtection: {

origin: true,

},

},

},

});

Enabling this setting makes Astro perform a check that the “origin” header, automatically passed by all modern browsers, matches the URL sent by each Request. If it doesn’t, Astro will respond with a 403 Forbidden status code.

Note that this feature is only available for pages that are rendered on-demand (also known as server-side rendering).

Cookies improvements

Thanks to Farzard, Astro’s helper for deleting cookies (Astro.cookies.delete) now allows setting even more cookie attributes instead of just the path and domain attributes. Perhaps a “bite-sized” change, but definitely one you can sink your teeth into!

Deprecated support for older versions of Node.js

In accordance with our Node.js support and upgrade policy, this version of Astro deprecates support for:

  • versions of Node.js 18 lower than 18.17.1
  • Node.js 19 (the odd numbered version)
  • versions of Node.js 20 lower than 20.3.0.

As described in our support policy, this decision was made after careful consideration of several factors. We believe this change will result in a more stable and secure Astro experience for all users.

You can continue to use deprecated versions of Node.js until the next major version of Astro (v5). However, you may see warnings when installing Astro and certain features may not work as expected.

Bug Fixes

You know it, Astro 4.6 includes more bug fixes and smaller improvements that couldn’t make it into this release post! Check out the full release notes to learn more.