diff --git a/src/content/docs/cloudflare-for-platforms/workers-for-platforms/configuration/static-assets.mdx b/src/content/docs/cloudflare-for-platforms/workers-for-platforms/configuration/static-assets.mdx index 0e167fe5d2a904c..c658dd2c3d95def 100644 --- a/src/content/docs/cloudflare-for-platforms/workers-for-platforms/configuration/static-assets.mdx +++ b/src/content/docs/cloudflare-for-platforms/workers-for-platforms/configuration/static-assets.mdx @@ -4,7 +4,7 @@ title: Static assets description: Host static assets on Cloudflare's global network and deliver faster load times worldwide with Workers for Platforms. --- -import { Aside } from "@astrojs/starlight/components"; + Workers for Platforms lets you deploy front-end applications at scale. By hosting static assets on Cloudflare's global network, you can deliver faster load times worldwide and eliminate the need for external infrastructure. You can also combine these static assets with dynamic logic in Cloudflare Workers, providing a full-stack experience for your customers. @@ -57,12 +57,11 @@ Before sending any file data, you need to tell Cloudflare which files you intend - A hash (32-hex characters) representing the file contents - The file size in bytes - +::: #### Example manifest (JSON) @@ -134,9 +133,9 @@ If the response to the Upload Session API returns `buckets`, that means you have Use the [Workers Assets Upload API](/api/resources/workers/subresources/assets/subresources/upload/) to transmit the raw file bytes in base64-encoded format for any missing or changed files. Once uploaded, Cloudflare will store these files so they can then be attached to a User Worker. - +:::caution +Asset uniqueness is determined by the provided hash and are associated globally to their namespace rather than with each specific User Worker. If an asset has already been uploaded for that namespace earlier, Cloudflare will automatically omit sending this asset hash back in the `buckets` response to save you from re-uploading the same thing twice. This means that an asset can be shared between multiple User Workers if it shares the same hash unless you **explicitly make the hash unique**. If you require full isolation between assets across User Workers, incorporate a unique identifier within your asset hashing process (either salting it with something entirely random each time, or by including the end-user account ID or their Worker name to retain per-customer re-use). +::: #### API Request Authentication diff --git a/src/content/docs/workers/development-testing/environment-variables.mdx b/src/content/docs/workers/development-testing/environment-variables.mdx index fb87831bb69fc8a..e8708765a5712d4 100644 --- a/src/content/docs/workers/development-testing/environment-variables.mdx +++ b/src/content/docs/workers/development-testing/environment-variables.mdx @@ -7,13 +7,13 @@ head: [] description: Configuring environment variables and secrets for local development --- -import { Aside, PackageManagers, Steps } from "~/components"; +import { PackageManagers, Steps } from "~/components"; During local development, you may need to configure **environment variables** (such as API URLs, feature flags) and **secrets** (API tokens, private keys). You can use a `.dev.vars` file in the root of your project to override environment variables for local development, and both [Wrangler](/workers/configuration/environment-variables/#compare-secrets-and-environment-variables) and the [Vite plugin](/workers/vite-plugin/reference/secrets/) will respect this override. - +:::caution +Be sure to add `.dev.vars` to your `.gitignore` so it never gets committed. +::: ### Why use a `.dev.vars` file? diff --git a/src/content/docs/workers/development-testing/index.mdx b/src/content/docs/workers/development-testing/index.mdx index 76cecc80666d7bb..bcbf00ae69c510c 100644 --- a/src/content/docs/workers/development-testing/index.mdx +++ b/src/content/docs/workers/development-testing/index.mdx @@ -13,7 +13,6 @@ import { Render, PackageManagers, WranglerConfig, - Aside, InlineBadge, CardGrid, Card, @@ -266,13 +265,11 @@ To connect to a high-fidelity version of the Images API, and verify that all tra - +::: #### [Dispatch Namespaces](/cloudflare-for-platforms/workers-for-platforms/get-started/developing-with-wrangler/): @@ -319,11 +316,9 @@ If `experimental_remote: true` is specified in Wrangler configuration for any of - [**Hyperdrive**](/workers/wrangler/configuration/#hyperdrive): This is being actively worked on, but is currently unsupported. - [**Rate Limiting**](/workers/runtime-apis/bindings/rate-limit/#configuration): Local development sessions typically should not share or affect rate limits of your deployed Workers. Rate limiting logic should be tested against local simulations. - +::: ### Important Considerations @@ -361,11 +356,9 @@ are however not directly compatible with `experimental_startRemoteProxySession`. pass them to `experimental_startRemoteProxySession`, so for this wrangler exposes `unstable_convertConfigBindingsToStartWorkerBindings` which is a simple utility to convert the bindings in an `Unstable_Config` object into a structure that can be passed to `experimental_startRemoteProxySession`. - +:::note +This type conversion is temporary. In the future, the types will be unified so you can pass the config object directly to `experimental_startRemoteProxySession`. +::: #### `experimental_maybeStartOrUpdateRemoteProxySession` diff --git a/src/content/docs/workers/development-testing/local-data.mdx b/src/content/docs/workers/development-testing/local-data.mdx index b82d3db601a0c91..4e214db389d07a2 100644 --- a/src/content/docs/workers/development-testing/local-data.mdx +++ b/src/content/docs/workers/development-testing/local-data.mdx @@ -13,7 +13,6 @@ import { Render, PackageManagers, FileTree, - Aside, } from "~/components"; Whether you are using Wrangler or the [Cloudflare Vite plugin](https://developers.cloudflare.com/workers/vite-plugin/), your workflow for **accessing** data during local development remains the same. However, you can only [populate local resources with data](/workers/development-testing/local-data/#populating-local-resources-with-data) via the Wrangler CLI. @@ -28,11 +27,9 @@ When you first start developing, your local resources will be empty. You'll need ### KV namespaces - +::: #### [Add a single key-value pair](/workers/wrangler/commands/#kv-key) diff --git a/src/content/docs/workers/development-testing/multi-workers.mdx b/src/content/docs/workers/development-testing/multi-workers.mdx index 99ec0ceae200941..c8efa16fdfaa675 100644 --- a/src/content/docs/workers/development-testing/multi-workers.mdx +++ b/src/content/docs/workers/development-testing/multi-workers.mdx @@ -7,17 +7,15 @@ head: [] description: Learn how to develop with multiple Workers using different approaches and configurations. --- -import { Aside, PackageManagers, Steps, WranglerConfig } from "~/components"; +import { PackageManagers, Steps, WranglerConfig } from "~/components"; When building complex applications, you may want to run multiple Workers during development. This guide covers the different approaches for running multiple Workers locally and when to use each approach. ## Single dev command - +::: You can run multiple Workers in a single dev command by passing multiple configuration files to your dev server: @@ -83,12 +81,9 @@ You can also run each Worker in a separate dev commands, each with its own termi These Workers run in different dev commands but can still communicate with each other via service bindings or tail consumers **regardless of whether they are started with `wrangler dev` or `vite dev`**. - +:::note +You can also combine both approaches — for example, run a group of Workers together through `vite dev` using `auxiliaryWorkers`, while running another Worker separately with `wrangler dev`. This allows you to keep tightly coupled Workers running under a single dev command, while keeping independent or shared Workers in separate ones. However, running `wrangler dev` with multiple configuration files (e.g. `wrangler dev -c ./app/wrangler.jsonc -c ./api/wrangler.jsonc`) does **not** support cross-process bindings at the moment. +::: **Use this approach when:** diff --git a/src/content/docs/workers/static-assets/routing/single-page-application.mdx b/src/content/docs/workers/static-assets/routing/single-page-application.mdx index 1a3ae71439d0418..795ec06514195b9 100644 --- a/src/content/docs/workers/static-assets/routing/single-page-application.mdx +++ b/src/content/docs/workers/static-assets/routing/single-page-application.mdx @@ -6,7 +6,7 @@ sidebar: order: 2 --- -import { WranglerConfig, Aside, TypeScriptExample, Render } from "~/components"; +import { WranglerConfig, TypeScriptExample, Render } from "~/components"; Single Page Applications (SPAs) are web applications which are client-side rendered (CSR). They are often built with a framework such as [React](/workers/framework-guides/web-apps/react/), [Vue](/workers/framework-guides/web-apps/vue/) or [Svelte](/workers/framework-guides/web-apps/svelte/). The build process of these frameworks will produce a single `/index.html` file and accompanying client-side resources (e.g. JavaScript bundles, CSS stylesheets, images, fonts, etc.). Typically, data is fetched by the client from an API with client-side requests. @@ -39,12 +39,11 @@ Configuring `assets.not_found_handling` to `single-page-application` overrides t For more explicit control over SPA routing behavior, you can use `run_worker_first` with an array of route patterns. This approach disables the automatic `Sec-Fetch-Mode: navigate` detection and gives you explicit control over which requests should be handled by your Worker script vs served as static assets. - +:::note +Advanced routing control is supported in: +- [Wrangler](/workers/wrangler/install-and-update/) v4.20.0 and above +- [Cloudflare Vite plugin](/workers/vite-plugin/get-started/) v1.7.0 and above +::: diff --git a/src/content/docs/workers/static-assets/routing/worker-script.mdx b/src/content/docs/workers/static-assets/routing/worker-script.mdx index adcb4290ab12b1f..d499ffd8a9c32de 100644 --- a/src/content/docs/workers/static-assets/routing/worker-script.mdx +++ b/src/content/docs/workers/static-assets/routing/worker-script.mdx @@ -6,7 +6,7 @@ sidebar: order: 4 --- -import { WranglerConfig, TypeScriptExample, Aside } from "~/components"; +import { WranglerConfig, TypeScriptExample } from "~/components"; If you have both static assets and a Worker script configured, Cloudflare will first attempt to serve static assets if one matches the incoming request. You can read more about how we match assets in the [HTML handling docs](/workers/static-assets/routing/advanced/html-handling/). @@ -18,14 +18,9 @@ This allows you to easily combine together these two features to create powerful You can configure the [`assets.run_worker_first` setting](/workers/static-assets/binding/#run_worker_first) to control when your Worker script runs relative to static asset serving. This gives you more control over exactly how and when those assets are served and can be used to implement "middleware" for requests. - +:::caution +If you are using [Smart Placement](/workers/configuration/smart-placement/) in combination with `assets.run_worker_first`, you may find that placement decisions are not optimized correctly as, currently, the entire Worker script is placed as a single unit. This may not accurately reflect the desired "split" in behavior of edge-first vs. smart-placed compute for your application. This is a limitation that we are currently working to resolve. +::: ### Run Worker before each request diff --git a/src/content/partials/networking-services/mconn/licence-keys.mdx b/src/content/partials/networking-services/mconn/licence-keys.mdx index 6b1accb045c7980..6f09bfda9b9b1cd 100644 --- a/src/content/partials/networking-services/mconn/licence-keys.mdx +++ b/src/content/partials/networking-services/mconn/licence-keys.mdx @@ -2,6 +2,8 @@ {} --- -import { Aside } from "~/components"; - \ No newline at end of file + +:::note +You cannot use the same license key twice, or reuse a key once the virtual machine has been registered with Cloudflare. You need a new key from your account team for every new Virtual Connector. +::: \ No newline at end of file diff --git a/src/content/partials/networking-services/mconn/vlan-tagging.mdx b/src/content/partials/networking-services/mconn/vlan-tagging.mdx index 7fd7e5e65501745..83a13991236cf71 100644 --- a/src/content/partials/networking-services/mconn/vlan-tagging.mdx +++ b/src/content/partials/networking-services/mconn/vlan-tagging.mdx @@ -3,10 +3,9 @@ params: - url --- -import { Aside, Markdown } from "~/components"; - - \ No newline at end of file +::: \ No newline at end of file diff --git a/src/content/partials/workers/navigation_requests.mdx b/src/content/partials/workers/navigation_requests.mdx index 4f68c52e90fde58..7aeeac857c1a2dd 100644 --- a/src/content/partials/workers/navigation_requests.mdx +++ b/src/content/partials/workers/navigation_requests.mdx @@ -2,19 +2,19 @@ {} --- -import { Aside, TypeScriptExample } from "~/components"; +import { TypeScriptExample } from "~/components"; ### Navigation requests If you have a Worker script (`main`), have configured `assets.not_found_handling`, and use the [`assets_navigation_prefers_asset_serving` compatibility flag](/workers/configuration/compatibility-flags/#navigation-requests-prefer-asset-serving) (or set a compatibility date of `2025-04-01` or greater), _navigation requests_ will not invoke the Worker script. A _navigation request_ is a request made with the `Sec-Fetch-Mode: navigate` header, which browsers automatically attach when navigating to a page. This reduces billable invocations of your Worker script, and is particularly useful for client-heavy applications which would otherwise invoke your Worker script very frequently and unnecessarily. - +::: - +::: #### Client-side callbacks