Skip to content

Commit 671b9d2

Browse files
Changelog update: Announce static asset support for Workers for Platforms (#19584)
* Add Workers for Platforms static assets changelog * Add description to Workers for Platforms static assets changelog * Changelog update: Announce static asset support for Workers for Platforms * Update src/content/changelogs-next/2025-01-31-workers-platforms-static-assets.mdx Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> --------- Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
1 parent f94766b commit 671b9d2

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Workers for Platforms now supports Static Assets
3+
description: Workers for Platforms customers can now serve static assets for User Workers directly from Cloudflare's global edge
4+
products:
5+
- workers-for-platforms
6+
date: 2025-01-31T17:00:00Z
7+
---
8+
9+
import { Render, TypeScriptExample } from "~/components";
10+
11+
Workers for Platforms customers can now attach static assets (HTML, CSS, JavaScript, images) directly to User Workers, removing the need to host separate infrastructure to serve the assets.
12+
13+
This allows your platform to serve entire front-end applications from Cloudflare's global edge, utilizing caching for fast load times, while supporting dynamic logic within the same Worker. Cloudflare automatically scales its infrastructure to handle high traffic volumes, enabling you to focus on building features without managing servers.
14+
15+
### What you can build
16+
17+
**Static Sites:** Host and serve HTML, CSS, JavaScript, and media files directly from Cloudflare's network, ensuring fast loading times worldwide. This is ideal for blogs, landing pages, and documentation sites because static assets can be efficiently cached and delivered closer to the user, reducing latency and enhancing the overall user experience.
18+
19+
**Full-Stack Applications:** Combine asset hosting with Cloudflare Workers to power dynamic, interactive applications. If you're an e-commerce platform, you can serve your customers' product pages and run inventory checks from within the same Worker.
20+
21+
<TypeScriptExample filename="index.ts">
22+
```ts
23+
export default {
24+
async fetch(request, env) {
25+
const url = new URL(request.url);
26+
27+
// Check real-time inventory
28+
if (url.pathname === '/api/inventory/check') {
29+
const product = url.searchParams.get('product');
30+
const inventory = await env.INVENTORY_KV.get(product);
31+
return new Response(inventory);
32+
}
33+
34+
// Serve static assets (HTML, CSS, images)
35+
return env.ASSETS.fetch(request);
36+
}
37+
};
38+
```
39+
</TypeScriptExample>
40+
41+
**Get Started:**
42+
Upload static assets using the Workers for Platforms API or Wrangler. For more information, visit our [Workers for Platforms documentation.](https://developers.cloudflare.com/cloudflare-for-platforms/workers-for-platforms/configuration/static-assets/)

0 commit comments

Comments
 (0)