Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ sidebar:
order: 3

---
import { DashButton } from "~/components";

## Build an AI application with Hono and Workers

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar:
order: 2
---

import { Render, PackageManagers } from "~/components";
import { Render, PackageManagers, DashButton } from "~/components";

## Build and deploy your first Worker

Expand Down
12 changes: 7 additions & 5 deletions src/content/docs/workers/ci-cd/builds/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:
order: 2
---

import { DirectoryListing, Render, Tabs, TabItem } from "~/components";
import { DirectoryListing, Render, Tabs, TabItem, DashButton } from "~/components";

When connecting your Git repository to your Worker, you can customize the configurations needed to build and deploy your Worker.

Expand Down Expand Up @@ -89,10 +89,12 @@ You can provide custom environment variables to your build.

To add environment variables via the dashboard:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In **Account Home**, select **Workers & Pages**.
3. In **Overview**, select your Worker.
4. Select **Settings** > **Environment variables**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker.
3. Select **Settings** > **Environment variables**.
</TabItem>
<TabItem label="Wrangler">
To add env variables using Wrangler, define text and JSON via the `[vars]` configuration in your Wrangler file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pcx_content_type: how-to
title: GitHub Actions
description: Integrate Workers development into your existing GitHub Actions workflows.
---
import { DashButton } from "~/components";

You can deploy Workers with [GitHub Actions](https://github.com/marketplace/actions/deploy-to-cloudflare-workers-with-wrangler). Here is how you can set up your GitHub Actions workflow.

Expand All @@ -17,12 +18,13 @@ To find your Cloudflare account ID, refer to [Find account and zone IDs](/fundam
### API token

To create an API token to authenticate Wrangler in your CI job:
1. In the Cloudflare dashboard, go to the **Account API tokens** page.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com).
2. Select **Manage Account** > **Account API Tokens**.
3. Select **Create Token** > find **Edit Cloudflare Workers** > select **Use Template**.
4. Customize your token name.
5. Scope your token.
<DashButton url="/?to=/:account/api-tokens" />

2. Select **Create Token** > find **Edit Cloudflare Workers** > select **Use Template**.
3. Customize your token name.
4. Scope your token.

You will need to choose the account and zone resources that the generated API token will have access to. We recommend scoping these down as much as possible to limit the access of your token. For example, if you have access to three different Cloudflare accounts, you should restrict the generated API token to only the account on which you will be deploying a Worker.

Expand Down
43 changes: 26 additions & 17 deletions src/content/docs/workers/configuration/cron-triggers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ head: []
description: Enable your Worker to be executed on a schedule.
---

import { Render, WranglerConfig, TabItem, Tabs } from "~/components";
import { Render, WranglerConfig, TabItem, Tabs, DashButton } from "~/components";

## Background

Expand Down Expand Up @@ -113,9 +113,11 @@ crons = ["0 * * * *"]

To add Cron Triggers in the Cloudflare dashboard:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In Account Home, select **Workers & Pages**.
3. In **Overview**, select your Worker > **Settings** > **Triggers** > **Cron Triggers**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker > **Settings** > **Triggers** > **Cron Triggers**.

## Supported cron expressions

Expand Down Expand Up @@ -195,11 +197,13 @@ curl "http://localhost:8787/cdn-cgi/handler/scheduled?cron=*+*+*+*+*&time=174585

To view the execution history of Cron Triggers, view **Cron Events**:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In Account Home, go to **Workers & Pages**.
3. In **Overview**, select your **Worker**.
4. Select **Settings**.
5. Under **Trigger Events**, select **View events**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your **Worker**.
3. Select **Settings**.
4. Under **Trigger Events**, select **View events**.

Cron Events stores the 100 most recent invocations of the Cron scheduled event. [Workers Logs](/workers/observability/logs/workers-logs) also records invocation logs for the Cron Trigger with a longer retention period and a filter & query interface. If you are interested in an API to access Cron Events, use Cloudflare's [GraphQL Analytics API](/analytics/graphql-api).

Expand All @@ -217,8 +221,11 @@ Refer to [Metrics and Analytics](/workers/observability/metrics-and-analytics/)

To delete a Cron Trigger on a deployed Worker via the dashboard:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **Workers & Pages**, and select your Worker.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select your Worker.
3. Go to **Triggers** > select the three dot icon next to the Cron Trigger you want to remove > **Delete**.

#### Via the [Wrangler configuration file](/workers/wrangler/configuration/)
Expand Down Expand Up @@ -252,12 +259,14 @@ Renewable energy can be purchased in a number of ways, including through on-site

Green Compute can be configured at the account level:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. In Account Home, select **Workers & Pages**.
3. In the **Account details** section, find **Compute Setting**.
4. Select **Change**.
5. Select **Green Compute**.
6. Select **Confirm**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In the **Account details** section, find **Compute Setting**.
3. Select **Change**.
4. Select **Green Compute**.
5. Select **Confirm**.

## Related resources

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ head: []
description: You can add environment variables, which are a type of binding, to attach text strings or JSON values to your Worker.
---

import { Render, TabItem, Tabs, WranglerConfig } from "~/components";
import { Render, TabItem, Tabs, WranglerConfig, DashButton } from "~/components";

## Background

Expand Down Expand Up @@ -79,15 +79,16 @@ Learn about [environments in Wrangler](/workers/wrangler/environments).
## Add environment variables via the dashboard

To add environment variables via the dashboard:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

1. Log in to [Cloudflare dashboard](https://dash.cloudflare.com/) and select your account.
2. Select **Workers & Pages**.
3. In **Overview**, select your Worker.
4. Select **Settings**.
5. Under **Variables and Secrets**, select **Add**.
6. Select a **Type**, input a **Variable name**, and input its **Value**. This variable will be made available to your Worker.
7. (Optional) To add multiple environment variables, select **Add variable**.
8. Select **Deploy** to implement your changes.
<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker.
3. Select **Settings**.
4. Under **Variables and Secrets**, select **Add**.
5. Select a **Type**, input a **Variable name**, and input its **Value**. This variable will be made available to your Worker.
6. (Optional) To add multiple environment variables, select **Add variable**.
7. Select **Deploy** to implement your changes.

:::caution[Plaintext strings and secrets]
Select the **Secret** type if your environment variable is a [secret](/workers/configuration/secrets/). Alternatively, consider [Cloudflare Secrets Store](/secrets-store/), for account-level secrets.
Expand Down
36 changes: 23 additions & 13 deletions src/content/docs/workers/configuration/routing/custom-domains.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Custom Domains

---

import { WranglerConfig } from "~/components";
import { WranglerConfig, DashButton } from "~/components";

## Background

Expand All @@ -27,7 +27,7 @@ To add a Custom Domain, you must have:
1. An [active Cloudflare zone](/dns/zone-setups/).
2. A Worker to invoke.

Custom Domains can be attached to your Worker via the [Cloudflare dashboard](/workers/configuration/routing/custom-domains/#set-up-a-custom-domain-in-the-dashboard), [Wrangler](/workers/configuration/routing/custom-domains/#set-up-a-custom-domain-in-your-wrangler-configuration-file) or the [API](/api/resources/workers/subresources/domains/methods/list/).
Custom Domains can be attached to your Worker via the Cloudflare dashboard, [Wrangler](/workers/configuration/routing/custom-domains/#set-up-a-custom-domain-in-your-wrangler-configuration-file) or the [API](/api/resources/workers/subresources/domains/methods/list/).

:::caution

Expand All @@ -41,8 +41,11 @@ You cannot create a Custom Domain on a hostname with an existing CNAME DNS recor

To set up a Custom Domain in the dashboard:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Select **Workers & Pages** and in **Overview**, select your Worker.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker.
3. Go to **Settings** > **Domains & Routes** > **Add** > **Custom Domain**.
4. Enter the domain you want to configure for your Worker.
5. Select **Add Custom Domain**.
Expand Down Expand Up @@ -149,21 +152,28 @@ If you are currently invoking a Worker using a [route](/workers/configuration/ro
### Migrate from Routes via the dashboard

To migrate the route `example.com/*`:
1. In the Cloudflare dashboard, go to the **Account home** page.

<DashButton url="/?to=/:account/home" />

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **DNS** and delete the CNAME record for `example.com`.
3. Go to **Account Home** > **Workers & Pages**.
4. In **Overview**, select your Worker > **Settings** > **Domains & Routes**.
5. Select **Add** > **Custom domain** and add `example.com`.
6. Delete the route `example.com/*` located in your Worker > **Settings** > **Domains & Routes**.
2. Select your domain.
3. Go to **DNS** and delete the CNAME record for `example.com`.
4. Go to **Account Home** > **Workers & Pages**.
5. In **Overview**, select your Worker > **Settings** > **Domains & Routes**.
6. Select **Add** > **Custom domain** and add `example.com`.
7. Delete the route `example.com/*` located in your Worker > **Settings** > **Domains & Routes**.

### Migrate from Routes via Wrangler

To migrate the route `example.com/*` in your [Wrangler configuration file](/workers/wrangler/configuration/):

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **DNS** and delete the CNAME record for `example.com`.
3. Add the following to your Wrangler file:
1. In the Cloudflare dashboard, go to the **Account home** page.

<DashButton url="/?to=/:account/home" />

2. Select your domain.
3. Go to **DNS** and delete the CNAME record for `example.com`.
4. Add the following to your Wrangler file:



Expand Down
10 changes: 6 additions & 4 deletions src/content/docs/workers/configuration/routing/routes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pcx_content_type: concept
title: Routes
---

import { WranglerConfig } from "~/components";
import { WranglerConfig, DashButton } from "~/components";

## Background

Expand Down Expand Up @@ -42,9 +42,11 @@ Routes can also be created via the API. Refer to the [Workers Routes API documen
Before you set up a route, make sure you have a DNS record set up for the [domain](/dns/manage-dns-records/how-to/create-zone-apex/) or [subdomain](/dns/manage-dns-records/how-to/create-subdomain/) you would like to route to.

To set up a route in the dashboard:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
2. Go to **Workers & Pages** and in **Overview**, select your Worker.
<DashButton url="/?to=/:account/workers-and-pages" />

2. In **Overview**, select your Worker.
3. Go to **Settings** > **Domains & Routes** > **Add** > **Route**.
4. Select the zone and enter the route pattern.
5. Select **Add route**.
Expand All @@ -71,7 +73,7 @@ zone_id = "<YOUR_ZONE_ID>"

</WranglerConfig>

Add the `zone_name` or `zone_id` option after each route. The `zone_name` and `zone_id` options are interchangeable. If using `zone_id`, find your zone ID by logging in to the [Cloudflare dashboard](https://dash.cloudflare.com) > select your account > select your website > find the **Zone ID** in the lefthand side of **Overview**.
Add the `zone_name` or `zone_id` option after each route. The `zone_name` and `zone_id` options are interchangeable. If using `zone_id`, find your zone ID by logging in to the Cloudflare dashboard > select your account > select your website > find the **Zone ID** in the left-hand side of **Overview**.

To add multiple routes:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ head: []
description: Incrementally deploy code changes to your Workers with gradual deployments.
---

import { Example } from "~/components";
import { Example, DashButton } from "~/components";

Gradual Deployments give you the ability to incrementally deploy new [versions](/workers/configuration/versions-and-deployments/#versions) of Workers by splitting traffic across versions.

Expand All @@ -19,7 +19,7 @@ Using gradual deployments, you can:

## Use gradual deployments

The following section guides you through an example usage of gradual deployments. You will choose to use either [Wrangler](/workers/configuration/versions-and-deployments/gradual-deployments/#via-wrangler) or the [Cloudflare dashboard](/workers/configuration/versions-and-deployments/gradual-deployments/#via-the-cloudflare-dashboard) to:
The following section guides you through an example usage of gradual deployments. You will choose to use either [Wrangler](/workers/configuration/versions-and-deployments/gradual-deployments/#via-wrangler) or the Cloudflare dashboard to:

- Create a new Worker.
- Publish a new version of that Worker without deploying it.
Expand Down Expand Up @@ -88,9 +88,11 @@ npx wrangler versions deploy

### Via the Cloudflare dashboard

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers) and select your account.
2. Go to **Workers & Pages**.
3. Select **Create application** > **Hello World** template > deploy your Worker.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select **Create application** > **Hello World** template > deploy your Worker.
4. Once the Worker is deployed, go to the online code editor through **Edit code**. Edit the Worker code (change the `Response` content) and upload the Worker.
5. To save changes, select the **down arrow** next to **Deploy** > **Save**. This will create a new version of your Worker.
6. Create a new deployment that splits traffic between the two versions created in step 3 and 5 by going to **Deployments** and selecting **Deploy Version**.
Expand Down Expand Up @@ -157,7 +159,7 @@ curl -s https://example.com -H 'Cloudflare-Workers-Version-Overrides: my-worker-

The dictionary can contain multiple key-value pairs. Each key indicates the name of the Worker the override should be applied to. The value indicates the version ID that should be used and must be a [String](https://www.rfc-editor.org/rfc/rfc8941#name-strings).

A version override will only be applied if the specified version is in the current deployment. The versions in the current deployment can be found using the [`wrangler deployments list`](/workers/wrangler/commands/#list-5) command or on the [Workers Dashboard](https://dash.cloudflare.com/?to=/:account/workers) under Worker > Deployments > Active Deployment.
A version override will only be applied if the specified version is in the current deployment. The versions in the current deployment can be found using the [`wrangler deployments list`](/workers/wrangler/commands/#list-5) command or on the **Workers & Pages** page of the Cloudflare dashboard > Select your Workers > Deployments > Active Deployment.

:::note[Verifying that the version override was applied]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ title: Versions & Deployments
head: []
description: Upload versions of Workers and create deployments to release new versions.
---
import { DashButton } from "~/components";

Versions track changes to your Worker. Deployments configure how those changes are deployed to your traffic.

Expand Down Expand Up @@ -83,9 +84,11 @@ Wrangler allows you to view the 10 most recent versions and deployments. Refer t

To view your deployments in the Cloudflare dashboard:

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers) and select your account.
2. Go to **Workers & Pages**.
3. Select your Worker > **Deployments**.
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

<DashButton url="/?to=/:account/workers-and-pages" />

2. Select your Worker > **Deployments**.

## Limits

Expand Down
6 changes: 5 additions & 1 deletion src/content/docs/workers/examples/103-early-hints.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ sidebar:
order: 1001
description: Allow a client to request static assets while waiting for the HTML response.
---
import { DashButton } from "~/components";

If you want to get started quickly, click on the button below.

Expand All @@ -26,7 +27,10 @@ import { TabItem, Tabs } from "~/components";

To ensure Early Hints are enabled on your zone:

1. Log in to the [Cloudflare Dashboard](https://dash.cloudflare.com) and select your account and website.
1. In the Cloudflare dashboard, go to the **Account home** page.

<DashButton url="/?to=/:account/home" />

2. Go to **Speed** > **Optimization** > **Content Optimization**.
3. Enable the **Early Hints** toggle to on.

Expand Down
8 changes: 5 additions & 3 deletions src/content/docs/workers/examples/images-workers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ sidebar:
description: Set up custom domain for Images using a Worker or serve images
using a prefix path and Cloudflare registered domain.
---
import { DashButton } from "~/components";

If you want to get started quickly, click on the button below.

Expand All @@ -23,10 +24,11 @@ This creates a repository in your GitHub account and deploys the application to
import { TabItem, Tabs } from "~/components";

To serve images from a custom domain:
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.

1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com).
2. Select your account > select **Workers & Pages**.
3. Select **Create application** > **Workers** > **Create Worker** and create your Worker.
<DashButton url="/?to=/:account/workers-and-pages" />

2. Select **Create application** > **Workers** > **Create Worker** and create your Worker.
4. In your Worker, select **Quick edit** and paste the following code.

<Tabs syncKey="workersExamples"> <TabItem label="JavaScript" icon="seti:javascript">
Expand Down
Loading
Loading