Skip to content

Commit 3bf8208

Browse files
danielrscaley-b
andauthored
[Workers] Workers Preview URLs now default to disabled (configuration.mdx, previews.mdx) (#24756)
* docs: Workers Preview URLs now default to disabled We're making changes in Wrangler and Dashboard so that Preview URLs default to disabled. Change the docs to reflect that. * Update src/content/docs/workers/configuration/previews.mdx --------- Co-authored-by: Caley Burton <[email protected]>
1 parent 218d8bd commit 3bf8208

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

src/content/docs/workers/configuration/previews.mdx

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ New versions of a Worker are created when you run:
4545
- [`wrangler versions upload`](/workers/wrangler/commands/#upload)
4646
- Or when you make edits via the Cloudflare dashboard
4747

48-
These URLs are public by default and available immediately after version creation.
48+
If Preview URLs have been enabled, they are **public by default** and available immediately after version creation.
4949

5050
:::note
5151
Minimum required Wrangler version: 3.74.0. Check your version by running `wrangler --version`. To update Wrangler, refer to [Install/Update Wrangler](/workers/wrangler/install-and-update/).
@@ -90,7 +90,7 @@ The resulting alias would be associated with this version, and immediately avail
9090

9191
## Manage access to Preview URLs
9292

93-
By default, all preview URLs are enabled and 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).
93+
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).
9494

9595
To limit your preview URLs to authorized emails only:
9696

@@ -116,46 +116,56 @@ You must press enter after you input your Application domain for it to save. You
116116
10. Go to the next page.
117117
11. Add application.
118118

119-
## Disabling Preview URLs
119+
## Toggle Preview URLs (Enable or Disable)
120120

121-
Disabling Preview URLs will disable routing to both versioned and aliased preview URLs.
121+
Note:
122122

123-
### Disabling Preview URLs in the dashboard
123+
- Preview URLs are disabled by default.
124+
- Disabling Preview URLs will disable routing to both versioned and aliased preview URLs.
124125

125-
To disable Preview URLs for a Worker:
126+
### From the Dashboard
127+
128+
To toggle Preview URLs for a Worker:
126129

127130
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
128131
2. Go to **Workers & Pages** and in **Overview**, select your Worker.
129132
3. Go to **Settings** > **Domains & Routes**.
130-
4. On "Preview URLs" click "Disable".
131-
5. Confirm you want to disable.
133+
4. For Preview URLs, click **Enable** or **Disable**.
134+
5. Confirm your action.
132135

133-
### Disabling Preview URLs in the [Wrangler configuration file](/workers/wrangler/configuration/)
136+
### From the [Wrangler configuration file](/workers/wrangler/configuration/)
134137

135138
:::note
136139
Wrangler 3.91.0 or higher is required to use this feature.
137140
:::
138141

139-
To disable Preview URLs for a Worker, include the following in your Worker's Wrangler file:
142+
:::note
143+
Older Wrangler versions will default to Preview URLs being enabled.
144+
:::
145+
146+
To toggle Preview URLs for a Worker, include any of the following in your Worker's Wrangler file:
140147

141148
<WranglerConfig>
149+
```toml
150+
preview_urls = true
151+
```
152+
</WranglerConfig>
142153

154+
<WranglerConfig>
143155
```toml
144156
preview_urls = false
145157
```
146-
147158
</WranglerConfig>
148159

149-
When you redeploy your Worker with this change, Preview URLs will be disabled.
160+
If not given, `preview_urls = false` is the default.
150161

151162
:::caution
152-
153-
If you disable Preview URLs in the Cloudflare dashboard but do not update your Worker's Wrangler file with `preview_urls = false`, then Preview URLs will be re-enabled the next time you deploy your Worker with Wrangler.
163+
If you enable or disable Preview URLs in the Cloudflare dashboard, but do not update your Worker's Wrangler file accordingly, the Preview URLs status will change the next time you deploy your Worker with Wrangler.
154164
:::
155165

156166
## Limitations
157167

158168
- Preview URLs are not generated for Workers that implement a [Durable Object](/durable-objects/).
159169
- 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.
160170
- You cannot currently configure Preview URLs to run on a subdomain other than [`workers.dev`](/workers/configuration/routing/workers-dev/).
161-
- You cannot view logs for Preview URLs today, this includes Workers Logs, Wrangler tail and Logpush.
171+
- You cannot view logs for Preview URLs today, this includes Workers Logs, Wrangler tail and Logpush.

src/content/docs/workers/wrangler/configuration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The `main` key is optional for assets-only Workers.
118118
- Enables use of `*.workers.dev` subdomain to deploy your Worker. If you have a Worker that is only for `scheduled` events, you can set this to `false`. Defaults to `true`. Refer to [types of routes](#types-of-routes).
119119

120120
- `preview_urls` <Type text="boolean" /> <MetaInfo text="optional" />
121-
- Enables use of Preview URLs to test your Worker. Defaults to `true`. Refer to [Preview URLs](/workers/configuration/previews).
121+
- Enables use of Preview URLs to test your Worker. Defaults to `false`. Refer to [Preview URLs](/workers/configuration/previews).
122122

123123
- `route` <Type text="Route" /> <MetaInfo text="optional" />
124124
- A route that your Worker should be deployed to. Only one of `routes` or `route` is required. Refer to [types of routes](#types-of-routes).

0 commit comments

Comments
 (0)