You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: You can now enable Cloudflare Access for your workers.dev and preview URLs in a single click.
4
+
products:
5
+
- workers
6
+
date: 2025-10-03
7
+
---
8
+
9
+
import { DashButton } from"~/components";
10
+
11
+
You can now enable [Cloudflare Access](/cloudflare-one/policies/access/) for your [`workers.dev`](/workers/configuration/routing/workers-dev/) and [Preview URLs](/workers/configuration/previews/) in a single click.
12
+
13
+

14
+
15
+
Access allows you to limit access to your Workers to specific users or groups. You can limit access to yourself, your teammates, your organization, or anyone else you specify in your [Access policy](/cloudflare-one/policies/access).
16
+
17
+
To enable Cloudflare Access:
18
+
19
+
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.
4. For `workers.dev` or Preview URLs, click **Enable Cloudflare Access**.
26
+
5. Optionally, to configure the Access application, click **Manage Cloudflare Access**. There, you can change the email addresses you want to authorize. View [Access policies](/cloudflare-one/policies/access/#selectors) to learn about configuring alternate rules.
27
+
28
+
To fully secure your application, it is important that you validate the JWT that Cloudflare Access adds to the `Cf-Access-Jwt-Assertion` header on the incoming request.
29
+
30
+
The following code will validate the JWT using the [jose NPM package](https://www.npmjs.com/package/jose):
Both of these appear in the modal that appears when you enable Cloudflare Access.
83
+
84
+
You can set these variables by adding them to your Worker's [Wrangler configuration file](/workers/wrangler/configuration/), or via the Cloudflare dashboard under **Workers & Pages** > **your-worker** > **Settings** > **Environment Variables**.
2. Go to the **Deployments** tab, and find the version you would like to view.
65
+
3. Go to the **Deployments** tab, and find the version you would like to view.
66
66
67
67
### Aliased preview URLs
68
68
@@ -97,29 +97,16 @@ The resulting alias would be associated with this version, and immediately avail
97
97
When enabled, all preview URLs are available publicly. You can use [Cloudflare Access](/cloudflare-one/policies/access/) to require visitors to authenticate before accessing preview URLs. You can limit access to yourself, your teammates, your organization, or anyone else you specify in your [access policy](/cloudflare-one/policies/access).
98
98
99
99
To limit your preview URLs to authorized emails only:
100
+
100
101
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.
4. Name your application (for example, "my-worker") and add your `workers.dev` subdomain as the **Application domain**.
107
-
108
-
For example, if you want to secure preview URLs for a Worker running on `my-worker.my-subdomain.workers.dev`.
109
-
110
-
- Subdomain: `*-my-worker`
111
-
- Domain: `my-subdomain.workers.dev`
112
-
113
-
:::note
114
-
You must press enter after you input your Application domain for it to save. You will see a "Zone is not associated with the current account" warning that you may ignore.
115
-
:::
116
-
117
-
6. Go to the next page.
118
-
7. Add a name for your access policy (for example, "Allow employees access to preview URLs for my-worker").
119
-
8. In the **Configure rules** section create a new rule with the **Emails** selector, or any other attributes which you wish to gate access to previews with.
120
-
9. Enter the emails you want to authorize. View [access policies](/cloudflare-one/policies/access/#selectors) to learn about configuring alternate rules.
121
-
10. Go to the next page.
122
-
11. Add application.
105
+
2. In **Overview**, select your Worker.
106
+
3. Go to **Settings** > **Domains & Routes**.
107
+
4. For Preview URLs, click **Enable Cloudflare Access**.
108
+
5. Optionally, to configure the Access application, click **Manage Cloudflare Access**. There, you can change the email addresses you want to authorize. View [Access policies](/cloudflare-one/policies/access/#selectors) to learn about configuring alternate rules.
109
+
6.[Validate the Access JWT](https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/validating-json/#cloudflare-workers-example) in your Worker script using the audience (`aud`) tag and JWKs URL provided.
123
110
124
111
## Toggle Preview URLs (Enable or Disable)
125
112
@@ -131,6 +118,7 @@ Note:
131
118
### From the Dashboard
132
119
133
120
To toggle Preview URLs for a Worker:
121
+
134
122
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.
@@ -153,15 +141,19 @@ Older Wrangler versions will default to Preview URLs being enabled.
153
141
To toggle Preview URLs for a Worker, include any of the following in your Worker's Wrangler file:
154
142
155
143
<WranglerConfig>
144
+
156
145
```toml
157
146
preview_urls = true
158
147
```
148
+
159
149
</WranglerConfig>
160
150
161
151
<WranglerConfig>
152
+
162
153
```toml
163
154
preview_urls = false
164
155
```
156
+
165
157
</WranglerConfig>
166
158
167
159
If not given, `preview_urls = false` is the default.
@@ -175,4 +167,4 @@ If you enable or disable Preview URLs in the Cloudflare dashboard, but do not up
175
167
- Preview URLs are not generated for Workers that implement a [Durable Object](/durable-objects/).
176
168
- Preview URLs are not currently generated for [Workers for Platforms](/cloudflare-for-platforms/workers-for-platforms/)[user Workers](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#user-workers). This is a temporary limitation, we are working to remove it.
177
169
- You cannot currently configure Preview URLs to run on a subdomain other than [`workers.dev`](/workers/configuration/routing/workers-dev/).
178
-
- You cannot view logs for Preview URLs today, this includes Workers Logs, Wrangler tail and Logpush.
170
+
- You cannot view logs for Preview URLs today, this includes Workers Logs, Wrangler tail and Logpush.
Copy file name to clipboardExpand all lines: src/content/docs/workers/configuration/routing/workers-dev.mdx
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,22 @@ It's recommended to run production Workers on a [Workers route or custom domain]
21
21
22
22
All Workers are assigned a `workers.dev` route when they are created or renamed following the syntax `<YOUR_WORKER_NAME>.<YOUR_SUBDOMAIN>.workers.dev`. The [`name`](/workers/wrangler/configuration/#inheritable-keys) field in your Worker configuration is used as the subdomain for the deployed Worker.
23
23
24
+
## Manage access to `workers.dev`
25
+
26
+
When enabled, your `workers.dev` URL is available publicly. You can use [Cloudflare Access](/cloudflare-one/policies/access/) to require visitors to authenticate before accessing preview URLs. You can limit access to yourself, your teammates, your organization, or anyone else you specify in your [access policy](/cloudflare-one/policies/access).
27
+
28
+
To limit your `workers.dev` URL to authorized emails only:
29
+
30
+
1. In the Cloudflare dashboard, go to the **Workers & Pages** page.
4. For `workers.dev`, click **Enable Cloudflare Access**.
37
+
5. Optionally, to configure the Access application, click **Manage Cloudflare Access**. There, you can change the email addresses you want to authorize. View [Access policies](/cloudflare-one/policies/access/#selectors) to learn about configuring alternate rules.
38
+
6.[Validate the Access JWT](https://developers.cloudflare.com/cloudflare-one/identity/authorization-cookie/validating-json/#cloudflare-workers-example) in your Worker script using the audience (`aud`) tag and JWKs URL provided.
39
+
24
40
## Disabling `workers.dev`
25
41
26
42
### Disabling `workers.dev` in the dashboard
@@ -38,7 +54,7 @@ To disable the `workers.dev` route for a Worker:
38
54
39
55
### Disabling `workers.dev` in the Wrangler configuration file
40
56
41
-
To disable the `workers.dev` route for a Worker, include the following in your Worker's [Wrangler configuration file](/workers/wrangler/configuration/):
57
+
To disable the `workers.dev` route for a Worker, include the following in your Worker's [Wrangler configuration file](/workers/wrangler/configuration/):
0 commit comments