Edge Static Asset Routing and On-Demand Islands
How static asset edge caching separates document delivery from interactive runtime islands and API execution.
Delivering content-heavy pages from an edge network requires separating immutable static documents from dynamic compute. When every navigation invokes a server runtime, latency variance and request quotas scale linearly with page views.
Routing Hierarchy at the Edge
In an asset-first deployment, incoming HTTP requests are matched against the static asset manifest before any server handler runs:
| Request Pattern | Execution Target | Latency Profile | Quota Cost |
|---|---|---|---|
GET /notes/* |
Edge Static Assets | 4–12 ms |
Free / Unlimited |
GET /_astro/*.js |
Immutable Edge Cache | 2–8 ms |
Free / Unlimited |
GET /api/* |
Worker Isolate | 10–35 ms |
Counted per invocation |
// Example: Selective worker invocation for API paths only
export default {
worker: {
name: "edge-workbench",
assets: {
notFoundHandling: "404-page",
runWorkerFirst: ["/api/*"],
},
},
};
Embedding Interactive Labs Inside MDX
Because MDX compiles to Astro components at build time, a static article can embed interactive client-side instruments directly inside the prose flow without turning the entire page into a single-page application:
Adjusting stiffness (k), damping (c), and mass (m) above recalculates the harmonic oscillator trajectory locally on a <canvas> element while the surrounding document remains zero-overhead static HTML.