From c5d130d8895e95886def135f15d7feb0a323ebd7 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Mon, 16 Jun 2025 15:05:58 +0100 Subject: [PATCH 1/7] [Browser Rendering] Update URL for Workers bindings --- public/__redirects | 10 +++++++--- src/content/docs/browser-rendering/get-started.mdx | 2 +- .../docs/browser-rendering/how-to/pdf-generation.mdx | 2 +- src/content/docs/browser-rendering/index.mdx | 4 ++-- .../docs/browser-rendering/platform/playwright.mdx | 2 +- .../docs/browser-rendering/platform/puppeteer.mdx | 2 +- src/content/docs/browser-rendering/rest-api/index.mdx | 4 ++-- .../browser-rendering-with-DO.mdx | 0 .../index.mdx | 0 .../reuse-sessions.mdx | 2 +- .../screenshots.mdx | 0 11 files changed, 16 insertions(+), 12 deletions(-) rename src/content/docs/browser-rendering/{workers-binding-api => workers-bindings}/browser-rendering-with-DO.mdx (100%) rename src/content/docs/browser-rendering/{workers-binding-api => workers-bindings}/index.mdx (100%) rename src/content/docs/browser-rendering/{workers-binding-api => workers-bindings}/reuse-sessions.mdx (94%) rename src/content/docs/browser-rendering/{workers-binding-api => workers-bindings}/screenshots.mdx (100%) diff --git a/public/__redirects b/public/__redirects index 765ac0a71a3d472..1c37a8996944541 100644 --- a/public/__redirects +++ b/public/__redirects @@ -240,9 +240,13 @@ /bots/additional-configurations/javascript-detections/ /cloudflare-challenges/challenge-types/javascript-detections/ 301 #browser-rendering -/browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-binding-api/browser-rendering-with-do/ 301 -/browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-binding-api/reuse-sessions/ 301 -/browser-rendering/get-started/screenshots/ /browser-rendering/workers-binding-api/screenshots/ 301 +/browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 +/browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 +/browser-rendering/get-started/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 +/browser-rendering/workers-binding-api/index/ /browser-rendering/workers-bindings/index/ 301 +/browser-rendering/workers-binding-api/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 +/browser-rendering/workers-binding-api/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 +/browser-rendering/workers-binding-api/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 # byoip /byoip/about/dynamic-advertisement/ /byoip/concepts/dynamic-advertisement/ 301 diff --git a/src/content/docs/browser-rendering/get-started.mdx b/src/content/docs/browser-rendering/get-started.mdx index 93d7392af50b71c..9efeb8ac79e2a36 100644 --- a/src/content/docs/browser-rendering/get-started.mdx +++ b/src/content/docs/browser-rendering/get-started.mdx @@ -7,5 +7,5 @@ sidebar: Browser rendering can be used in two ways: -- [Workers Bindings](/browser-rendering/workers-binding-api) for complex scripts. +- [Workers Bindings](/browser-rendering/workers-bindings/) for complex scripts. - [REST API](/browser-rendering/rest-api/) for simple actions. diff --git a/src/content/docs/browser-rendering/how-to/pdf-generation.mdx b/src/content/docs/browser-rendering/how-to/pdf-generation.mdx index fa47e6a20338a83..3ae7fe6725e22a5 100644 --- a/src/content/docs/browser-rendering/how-to/pdf-generation.mdx +++ b/src/content/docs/browser-rendering/how-to/pdf-generation.mdx @@ -7,7 +7,7 @@ sidebar: import { Aside, WranglerConfig, PackageManagers } from "~/components"; -As seen in the [Getting Started guide](/browser-rendering/workers-binding-api/screenshots/), Browser Rendering can be used to generate screenshots for any given URL. Alongside screenshots, you can also generate full PDF documents for a given webpage, and can also provide the webpage markup and style ourselves. +As seen in [this Workers bindings guide](/browser-rendering/workers-bindings/screenshots/), Browser Rendering can be used to generate screenshots for any given URL. Alongside screenshots, you can also generate full PDF documents for a given webpage, and can also provide the webpage markup and style ourselves. ## Prerequisites diff --git a/src/content/docs/browser-rendering/index.mdx b/src/content/docs/browser-rendering/index.mdx index 85a9583016eb954..1b10c5de1720446 100644 --- a/src/content/docs/browser-rendering/index.mdx +++ b/src/content/docs/browser-rendering/index.mdx @@ -32,9 +32,9 @@ Browser Rendering enables developers to programmatically control and interact wi You can integrate Browser Rendering into your applications using one of the following methods: - **[REST API](/browser-rendering/rest-api/)**: Ideal for simple, stateless tasks like capturing screenshots, generating PDFs, extracting HTML content, and more. -- **[Workers Bindings](/browser-rendering/workers-binding-api/)**: Suitable for advanced browser automation within [Cloudflare Workers](/workers/). This method provides greater control, enabling more complex workflows and persistent sessions. +- **[Workers Bindings](/browser-rendering/workers-bindings/)**: Suitable for advanced browser automation within [Cloudflare Workers](/workers/). This method provides greater control, enabling more complex workflows and persistent sessions. -Choose the method that best fits your use case. For example, use the [REST API endpoints](/browser-rendering/rest-api/) for straightforward tasks from external applications and use [Workers Bindings](/browser-rendering/workers-binding-api/) for complex automation within the Cloudflare ecosystem. +Choose the method that best fits your use case. For example, use the [REST API endpoints](/browser-rendering/rest-api/) for straightforward tasks from external applications and use [Workers Bindings](/browser-rendering/workers-bindings/) for complex automation within the Cloudflare ecosystem. ## Use Cases diff --git a/src/content/docs/browser-rendering/platform/playwright.mdx b/src/content/docs/browser-rendering/platform/playwright.mdx index 22cc19709838c76..596894197da37db 100644 --- a/src/content/docs/browser-rendering/platform/playwright.mdx +++ b/src/content/docs/browser-rendering/platform/playwright.mdx @@ -189,7 +189,7 @@ export default { ### Keep Alive -If users omit the `browser.close()` statement, the browser instance will stay open, ready to be connected to again and [re-used](/browser-rendering/workers-binding-api/reuse-sessions/) but it will, by default, close automatically after 1 minute of inactivity. Users can optionally extend this idle time up to 10 minutes, by using the `keep_alive` option, set in milliseconds: +If users omit the `browser.close()` statement, the browser instance will stay open, ready to be connected to again and [re-used](/browser-rendering/workers-bindings/reuse-sessions/) but it will, by default, close automatically after 1 minute of inactivity. Users can optionally extend this idle time up to 10 minutes, by using the `keep_alive` option, set in milliseconds: ```js const browser = await playwright.launch(env.MYBROWSER, { keep_alive: 600000 }); diff --git a/src/content/docs/browser-rendering/platform/puppeteer.mdx b/src/content/docs/browser-rendering/platform/puppeteer.mdx index 50a4b14930400af..1a97023a5f44983 100644 --- a/src/content/docs/browser-rendering/platform/puppeteer.mdx +++ b/src/content/docs/browser-rendering/platform/puppeteer.mdx @@ -66,7 +66,7 @@ This script [launches](https://pptr.dev/api/puppeteer.puppeteernode.launch) the ### Keep Alive -If users omit the `browser.close()` statement, it will stay open, ready to be connected to again and [re-used](/browser-rendering/workers-binding-api/reuse-sessions/) but it will, by default, close automatically after 1 minute of inactivity. Users can optionally extend this idle time up to 10 minutes, by using the `keep_alive` option, set in milliseconds: +If users omit the `browser.close()` statement, it will stay open, ready to be connected to again and [re-used](/browser-rendering/workers-bindings/reuse-sessions/) but it will, by default, close automatically after 1 minute of inactivity. Users can optionally extend this idle time up to 10 minutes, by using the `keep_alive` option, set in milliseconds: ```js const browser = await puppeteer.launch(env.MYBROWSER, { keep_alive: 600000 }); diff --git a/src/content/docs/browser-rendering/rest-api/index.mdx b/src/content/docs/browser-rendering/rest-api/index.mdx index 31420b9b7aa08ff..fa116caf8e3841c 100644 --- a/src/content/docs/browser-rendering/rest-api/index.mdx +++ b/src/content/docs/browser-rendering/rest-api/index.mdx @@ -12,7 +12,7 @@ import { DirectoryListing } from "~/components"; -Use the REST API when you need a fast, simple way to perform common browser tasks such as capturing screenshots, extracting HTML, or generating PDFs without writing complex scripts. If you require more advanced automation, custom workflows, or persistent browser sessions, [Workers Bindings](/browser-rendering/workers-binding-api/) are the better choice. +Use the REST API when you need a fast, simple way to perform common browser tasks such as capturing screenshots, extracting HTML, or generating PDFs without writing complex scripts. If you require more advanced automation, custom workflows, or persistent browser sessions, [Workers Bindings](/browser-rendering/workers-bindings/) are the better choice. ## Before you begin @@ -22,6 +22,6 @@ Before you begin, make sure you [create a custom API Token](/fundamentals/api/ge :::note[Note] -Currently, the Cloudflare dashboard displays usage metrics exclusively for the [Workers Bindings method](/browser-rendering/workers-binding-api/). Usage data for the REST API is not yet available in the dashboard. We are actively working on adding REST API usage metrics to the dashboard. +Currently, the Cloudflare dashboard displays usage metrics exclusively for the [Workers Bindings method](/browser-rendering/workers-bindings/). Usage data for the REST API is not yet available in the dashboard. We are actively working on adding REST API usage metrics to the dashboard. ::: diff --git a/src/content/docs/browser-rendering/workers-binding-api/browser-rendering-with-DO.mdx b/src/content/docs/browser-rendering/workers-bindings/browser-rendering-with-DO.mdx similarity index 100% rename from src/content/docs/browser-rendering/workers-binding-api/browser-rendering-with-DO.mdx rename to src/content/docs/browser-rendering/workers-bindings/browser-rendering-with-DO.mdx diff --git a/src/content/docs/browser-rendering/workers-binding-api/index.mdx b/src/content/docs/browser-rendering/workers-bindings/index.mdx similarity index 100% rename from src/content/docs/browser-rendering/workers-binding-api/index.mdx rename to src/content/docs/browser-rendering/workers-bindings/index.mdx diff --git a/src/content/docs/browser-rendering/workers-binding-api/reuse-sessions.mdx b/src/content/docs/browser-rendering/workers-bindings/reuse-sessions.mdx similarity index 94% rename from src/content/docs/browser-rendering/workers-binding-api/reuse-sessions.mdx rename to src/content/docs/browser-rendering/workers-bindings/reuse-sessions.mdx index dc17f7e7cd3fb34..080a15e59cfffbc 100644 --- a/src/content/docs/browser-rendering/workers-binding-api/reuse-sessions.mdx +++ b/src/content/docs/browser-rendering/workers-bindings/reuse-sessions.mdx @@ -7,7 +7,7 @@ sidebar: import { Render, PackageManagers, WranglerConfig } from "~/components"; -The best way to improve the performance of your browser rendering Worker is to reuse sessions. One way to do that is via [Durable Objects](/browser-rendering/workers-binding-api/browser-rendering-with-do/), which allows you to keep a long running connection from a Worker to a browser. Another way is to keep the browser open after you've finished with it, and connect to that session each time you have a new request. +The best way to improve the performance of your browser rendering Worker is to reuse sessions. One way to do that is via [Durable Objects](/browser-rendering/workers-bindings/browser-rendering-with-do/), which allows you to keep a long running connection from a Worker to a browser. Another way is to keep the browser open after you've finished with it, and connect to that session each time you have a new request. In short, this entails using `browser.disconnect()` instead of `browser.close()`, and, if there are available sessions, using `puppeteer.connect(env.MY_BROWSER, sessionID)` instead of launching a new browser session. diff --git a/src/content/docs/browser-rendering/workers-binding-api/screenshots.mdx b/src/content/docs/browser-rendering/workers-bindings/screenshots.mdx similarity index 100% rename from src/content/docs/browser-rendering/workers-binding-api/screenshots.mdx rename to src/content/docs/browser-rendering/workers-bindings/screenshots.mdx From 8509295166be713ea18ec3d29504139cdab2bab4 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Mon, 16 Jun 2025 16:19:14 +0100 Subject: [PATCH 2/7] Update public/__redirects Co-authored-by: Kody Jackson --- public/__redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/__redirects b/public/__redirects index 1c37a8996944541..5b4b1d2532f684d 100644 --- a/public/__redirects +++ b/public/__redirects @@ -243,7 +243,7 @@ /browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 /browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 /browser-rendering/get-started/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 -/browser-rendering/workers-binding-api/index/ /browser-rendering/workers-bindings/index/ 301 +/browser-rendering/workers-binding-api/ /browser-rendering/workers-bindings/index/ 301 /browser-rendering/workers-binding-api/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 /browser-rendering/workers-binding-api/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 /browser-rendering/workers-binding-api/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 From 86056e1b25e3a4552a16eb39f96334cb68491a22 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Mon, 16 Jun 2025 16:21:51 +0100 Subject: [PATCH 3/7] Update public/__redirects --- public/__redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/__redirects b/public/__redirects index 5b4b1d2532f684d..3d4bb6d0e27be41 100644 --- a/public/__redirects +++ b/public/__redirects @@ -243,7 +243,7 @@ /browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 /browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 /browser-rendering/get-started/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 -/browser-rendering/workers-binding-api/ /browser-rendering/workers-bindings/index/ 301 +/browser-rendering/workers-binding-api/ /browser-rendering/workers-bindings/ 301 /browser-rendering/workers-binding-api/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 /browser-rendering/workers-binding-api/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 /browser-rendering/workers-binding-api/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 From 8175372b32dc93d56d2980926bda8683c95c8bc9 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Mon, 16 Jun 2025 16:54:17 +0100 Subject: [PATCH 4/7] Update public/__redirects --- public/__redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/__redirects b/public/__redirects index 3d4bb6d0e27be41..e602caddaf6a5af 100644 --- a/public/__redirects +++ b/public/__redirects @@ -240,7 +240,7 @@ /bots/additional-configurations/javascript-detections/ /cloudflare-challenges/challenge-types/javascript-detections/ 301 #browser-rendering -/browser-rendering/get-started/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 +/browser-rendering/get-started/browser-rendering-with-DO/ /browser-rendering/workers-bindings/browser-rendering-with-DO/ 301 /browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 /browser-rendering/get-started/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 /browser-rendering/workers-binding-api/ /browser-rendering/workers-bindings/ 301 From d2952ae094f0c33dbc42312946887aec8b5de5f0 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Mon, 16 Jun 2025 17:28:40 +0100 Subject: [PATCH 5/7] Update public/__redirects --- public/__redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/__redirects b/public/__redirects index e602caddaf6a5af..b6c968b74c8bd58 100644 --- a/public/__redirects +++ b/public/__redirects @@ -245,7 +245,7 @@ /browser-rendering/get-started/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 /browser-rendering/workers-binding-api/ /browser-rendering/workers-bindings/ 301 /browser-rendering/workers-binding-api/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 -/browser-rendering/workers-binding-api/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 +/browser-rendering/workers-binding-api/browser-rendering-with-DO/ /browser-rendering/workers-bindings/browser-rendering-with-DO/ 301 /browser-rendering/workers-binding-api/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 # byoip From a9380f4581f34fd227c3e755dd6f5744038b5985 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Tue, 24 Jun 2025 11:45:28 -0400 Subject: [PATCH 6/7] Update public/__redirects --- public/__redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/__redirects b/public/__redirects index b6c968b74c8bd58..e602caddaf6a5af 100644 --- a/public/__redirects +++ b/public/__redirects @@ -245,7 +245,7 @@ /browser-rendering/get-started/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 /browser-rendering/workers-binding-api/ /browser-rendering/workers-bindings/ 301 /browser-rendering/workers-binding-api/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 -/browser-rendering/workers-binding-api/browser-rendering-with-DO/ /browser-rendering/workers-bindings/browser-rendering-with-DO/ 301 +/browser-rendering/workers-binding-api/browser-rendering-with-do/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 /browser-rendering/workers-binding-api/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 # byoip From faa9988221fa91472ae8c74aeb37ccd945b9f815 Mon Sep 17 00:00:00 2001 From: ToriLindsay Date: Tue, 24 Jun 2025 14:35:13 -0400 Subject: [PATCH 7/7] Update public/__redirects Co-authored-by: Kody Jackson --- public/__redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/__redirects b/public/__redirects index e602caddaf6a5af..2643193663b9504 100644 --- a/public/__redirects +++ b/public/__redirects @@ -240,7 +240,7 @@ /bots/additional-configurations/javascript-detections/ /cloudflare-challenges/challenge-types/javascript-detections/ 301 #browser-rendering -/browser-rendering/get-started/browser-rendering-with-DO/ /browser-rendering/workers-bindings/browser-rendering-with-DO/ 301 +/browser-rendering/get-started/browser-rendering-with-DO/ /browser-rendering/workers-bindings/browser-rendering-with-do/ 301 /browser-rendering/get-started/reuse-sessions/ /browser-rendering/workers-bindings/reuse-sessions/ 301 /browser-rendering/get-started/screenshots/ /browser-rendering/workers-bindings/screenshots/ 301 /browser-rendering/workers-binding-api/ /browser-rendering/workers-bindings/ 301