From 0885e6e9302587fe70bdaa992ac27879329c9d6d Mon Sep 17 00:00:00 2001 From: Lucas Kostka Date: Wed, 16 Apr 2025 19:54:10 +0200 Subject: [PATCH 1/2] Added Deploy to Cloudflare button to Cloudflare Workers examples --- src/content/docs/workers/examples/103-early-hints.mdx | 2 ++ .../docs/workers/examples/accessing-the-cloudflare-object.mdx | 2 ++ src/content/docs/workers/examples/aggregate-requests.mdx | 2 ++ src/content/docs/workers/examples/alter-headers.mdx | 2 ++ src/content/docs/workers/examples/cache-api.mdx | 2 ++ src/content/docs/workers/examples/cache-post-request.mdx | 2 ++ src/content/docs/workers/examples/cache-tags.mdx | 2 ++ src/content/docs/workers/examples/cache-using-fetch.mdx | 2 ++ src/content/docs/workers/examples/conditional-response.mdx | 2 ++ src/content/docs/workers/examples/cors-header-proxy.mdx | 2 ++ src/content/docs/workers/examples/country-code-redirect.mdx | 2 ++ src/content/docs/workers/examples/cron-trigger.mdx | 2 ++ src/content/docs/workers/examples/data-loss-prevention.mdx | 2 ++ src/content/docs/workers/examples/debugging-logs.mdx | 2 ++ src/content/docs/workers/examples/extract-cookie-value.mdx | 2 ++ src/content/docs/workers/examples/fetch-html.mdx | 2 ++ src/content/docs/workers/examples/fetch-json.mdx | 2 ++ src/content/docs/workers/examples/geolocation-app-weather.mdx | 2 ++ .../docs/workers/examples/geolocation-custom-styling.mdx | 2 ++ src/content/docs/workers/examples/geolocation-hello-world.mdx | 2 ++ src/content/docs/workers/examples/hot-link-protection.mdx | 2 ++ src/content/docs/workers/examples/images-workers.mdx | 2 ++ src/content/docs/workers/examples/logging-headers.mdx | 2 ++ src/content/docs/workers/examples/modify-request-property.mdx | 2 ++ src/content/docs/workers/examples/modify-response.mdx | 2 ++ src/content/docs/workers/examples/multiple-cron-triggers.mdx | 2 ++ src/content/docs/workers/examples/openai-sdk-streaming.mdx | 2 ++ src/content/docs/workers/examples/post-json.mdx | 2 ++ .../docs/workers/examples/protect-against-timing-attacks.mdx | 2 ++ src/content/docs/workers/examples/read-post.mdx | 2 ++ src/content/docs/workers/examples/redirect.mdx | 2 ++ src/content/docs/workers/examples/respond-with-another-site.mdx | 2 ++ src/content/docs/workers/examples/return-html.mdx | 2 ++ src/content/docs/workers/examples/return-json.mdx | 2 ++ src/content/docs/workers/examples/rewrite-links.mdx | 2 ++ src/content/docs/workers/examples/security-headers.mdx | 2 ++ src/content/docs/workers/examples/signing-requests.mdx | 2 ++ 37 files changed, 74 insertions(+) diff --git a/src/content/docs/workers/examples/103-early-hints.mdx b/src/content/docs/workers/examples/103-early-hints.mdx index 4753b6f032471e7..224a035a1e5cdd6 100644 --- a/src/content/docs/workers/examples/103-early-hints.mdx +++ b/src/content/docs/workers/examples/103-early-hints.mdx @@ -15,6 +15,8 @@ sidebar: description: Allow a client to request static assets while waiting for the HTML response. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/103-early-hints) + import { TabItem, Tabs } from "~/components"; `103` Early Hints is an HTTP status code designed to speed up content delivery. When enabled, Cloudflare can cache the `Link` headers marked with preload and/or preconnect from HTML pages and serve them in a `103` Early Hints response before reaching the origin server. Browsers can use these hints to fetch linked assets while waiting for the origin’s final response, dramatically improving page load speeds. diff --git a/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx b/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx index 2c3d21d8708548f..b321f541e518498 100644 --- a/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx +++ b/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx @@ -16,6 +16,8 @@ description: Access custom Cloudflare properties and control how Cloudflare features are applied to every request. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/accessing-the-cloudflare-object) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/aggregate-requests.mdx b/src/content/docs/workers/examples/aggregate-requests.mdx index 4ca913c65272d2e..82e108619fff769 100644 --- a/src/content/docs/workers/examples/aggregate-requests.mdx +++ b/src/content/docs/workers/examples/aggregate-requests.mdx @@ -14,6 +14,8 @@ description: Send two GET request to two urls and aggregates the responses into one response. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/aggregate-requests) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/alter-headers.mdx b/src/content/docs/workers/examples/alter-headers.mdx index f04da40ccc49445..f605c0eb13d05ca 100644 --- a/src/content/docs/workers/examples/alter-headers.mdx +++ b/src/content/docs/workers/examples/alter-headers.mdx @@ -19,6 +19,8 @@ description: Example of how to add, change, or delete headers sent in a request or returned in a response. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/alter-headers) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-api.mdx b/src/content/docs/workers/examples/cache-api.mdx index 3082c2749c05cad..4fab6cb7b6801ab 100644 --- a/src/content/docs/workers/examples/cache-api.mdx +++ b/src/content/docs/workers/examples/cache-api.mdx @@ -15,6 +15,8 @@ sidebar: description: Use the Cache API to store responses in Cloudflare's cache. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-api) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-post-request.mdx b/src/content/docs/workers/examples/cache-post-request.mdx index 725722ea28d0763..0a50f9ec47a2b79 100644 --- a/src/content/docs/workers/examples/cache-post-request.mdx +++ b/src/content/docs/workers/examples/cache-post-request.mdx @@ -15,6 +15,8 @@ sidebar: description: Cache POST requests using the Cache API. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-post-request) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-tags.mdx b/src/content/docs/workers/examples/cache-tags.mdx index 0b0993baf4458c3..3602a7713c21b66 100644 --- a/src/content/docs/workers/examples/cache-tags.mdx +++ b/src/content/docs/workers/examples/cache-tags.mdx @@ -14,6 +14,8 @@ sidebar: description: Send Additional Cache Tags using Workers --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-tags) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-using-fetch.mdx b/src/content/docs/workers/examples/cache-using-fetch.mdx index e42e86d9106b6d6..ef6af5bf0d523db 100644 --- a/src/content/docs/workers/examples/cache-using-fetch.mdx +++ b/src/content/docs/workers/examples/cache-using-fetch.mdx @@ -18,6 +18,8 @@ description: Determine how to cache a resource by setting TTLs, custom cache keys, and cache headers in a fetch request. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-using-fetch) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/conditional-response.mdx b/src/content/docs/workers/examples/conditional-response.mdx index 1295423b4e000c9..ce7cd03e1929ce6 100644 --- a/src/content/docs/workers/examples/conditional-response.mdx +++ b/src/content/docs/workers/examples/conditional-response.mdx @@ -16,6 +16,8 @@ description: Return a response based on the incoming request's URL, HTTP method, User Agent, IP address, ASN or device type. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/conditional-response) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cors-header-proxy.mdx b/src/content/docs/workers/examples/cors-header-proxy.mdx index e25baa21e3c8f57..f0ea06f4d3d176c 100644 --- a/src/content/docs/workers/examples/cors-header-proxy.mdx +++ b/src/content/docs/workers/examples/cors-header-proxy.mdx @@ -16,6 +16,8 @@ sidebar: description: Add the necessary CORS headers to a third party API response. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cors-header-proxy) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/country-code-redirect.mdx b/src/content/docs/workers/examples/country-code-redirect.mdx index fe6b7da2794c8f3..eaaf62d80f4e864 100644 --- a/src/content/docs/workers/examples/country-code-redirect.mdx +++ b/src/content/docs/workers/examples/country-code-redirect.mdx @@ -17,6 +17,8 @@ sidebar: description: Redirect a response based on the country code in the header of a visitor. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/country-code-redirect) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cron-trigger.mdx b/src/content/docs/workers/examples/cron-trigger.mdx index 99084729e2d0355..f09b6a89adf0c62 100644 --- a/src/content/docs/workers/examples/cron-trigger.mdx +++ b/src/content/docs/workers/examples/cron-trigger.mdx @@ -13,6 +13,8 @@ sidebar: description: Set a Cron Trigger for your Worker. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cron-trigger) + import { Render, TabItem, Tabs, WranglerConfig } from "~/components"; diff --git a/src/content/docs/workers/examples/data-loss-prevention.mdx b/src/content/docs/workers/examples/data-loss-prevention.mdx index e7d6a3e1ac9e65d..ebd7c17aeaa39e4 100644 --- a/src/content/docs/workers/examples/data-loss-prevention.mdx +++ b/src/content/docs/workers/examples/data-loss-prevention.mdx @@ -16,6 +16,8 @@ description: Protect sensitive data to prevent data loss, and send alerts to a webhooks server in the event of a data breach. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/data-loss-prevention) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/debugging-logs.mdx b/src/content/docs/workers/examples/debugging-logs.mdx index d706124f7ba1225..cfe999c98f55376 100644 --- a/src/content/docs/workers/examples/debugging-logs.mdx +++ b/src/content/docs/workers/examples/debugging-logs.mdx @@ -14,6 +14,8 @@ sidebar: description: Send debugging information in an errored response to a logging service. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/debugging-logs) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/extract-cookie-value.mdx b/src/content/docs/workers/examples/extract-cookie-value.mdx index e7ca1c827b34c34..7d4e70b606f29f6 100644 --- a/src/content/docs/workers/examples/extract-cookie-value.mdx +++ b/src/content/docs/workers/examples/extract-cookie-value.mdx @@ -16,6 +16,8 @@ description: Given the cookie name, get the value of a cookie. You can also use cookies for A/B testing. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/extract-cookie-value) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/fetch-html.mdx b/src/content/docs/workers/examples/fetch-html.mdx index cabe56f40fecd5f..de2123fba58ddfb 100644 --- a/src/content/docs/workers/examples/fetch-html.mdx +++ b/src/content/docs/workers/examples/fetch-html.mdx @@ -17,6 +17,8 @@ description: Send a request to a remote server, read HTML from the response, and serve that HTML. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/fetch-html) + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/fetch-json.mdx b/src/content/docs/workers/examples/fetch-json.mdx index fbfdd541d4f5e22..ca468bf7893ecd7 100644 --- a/src/content/docs/workers/examples/fetch-json.mdx +++ b/src/content/docs/workers/examples/fetch-json.mdx @@ -16,6 +16,8 @@ description: Send a GET request and read in JSON from the response. Use to fetch external data. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/fetch-json) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/geolocation-app-weather.mdx b/src/content/docs/workers/examples/geolocation-app-weather.mdx index ef190d1c3f5b68c..c0232500e123679 100644 --- a/src/content/docs/workers/examples/geolocation-app-weather.mdx +++ b/src/content/docs/workers/examples/geolocation-app-weather.mdx @@ -14,6 +14,8 @@ sidebar: description: Fetch weather data from an API using the user's geolocation data. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/geolocation-app-weather) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/geolocation-custom-styling.mdx b/src/content/docs/workers/examples/geolocation-custom-styling.mdx index 416cd92c9f41102..39baadb5888bd9c 100644 --- a/src/content/docs/workers/examples/geolocation-custom-styling.mdx +++ b/src/content/docs/workers/examples/geolocation-custom-styling.mdx @@ -13,6 +13,8 @@ sidebar: description: Personalize website styling based on localized user time. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/geolocation-custom-styling) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/geolocation-hello-world.mdx b/src/content/docs/workers/examples/geolocation-hello-world.mdx index 3813dcc67e2eac3..9849a745cbb1994 100644 --- a/src/content/docs/workers/examples/geolocation-hello-world.mdx +++ b/src/content/docs/workers/examples/geolocation-hello-world.mdx @@ -16,6 +16,8 @@ sidebar: description: Get all geolocation data fields and display them in HTML. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/geolocation-hello-world) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/hot-link-protection.mdx b/src/content/docs/workers/examples/hot-link-protection.mdx index 215019617c479d8..0bf2e982d38918c 100644 --- a/src/content/docs/workers/examples/hot-link-protection.mdx +++ b/src/content/docs/workers/examples/hot-link-protection.mdx @@ -17,6 +17,8 @@ description: Block other websites from linking to your content. This is useful for protecting images. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/hot-link-protection) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/images-workers.mdx b/src/content/docs/workers/examples/images-workers.mdx index 776068d2a938b98..94008560cfbcad6 100644 --- a/src/content/docs/workers/examples/images-workers.mdx +++ b/src/content/docs/workers/examples/images-workers.mdx @@ -14,6 +14,8 @@ description: Set up custom domain for Images using a Worker or serve images using a prefix path and Cloudflare registered domain. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/images-workers) + import { TabItem, Tabs } from "~/components"; To serve images from a custom domain: diff --git a/src/content/docs/workers/examples/logging-headers.mdx b/src/content/docs/workers/examples/logging-headers.mdx index 04e84e90fd5a175..50aa3e979f684ef 100644 --- a/src/content/docs/workers/examples/logging-headers.mdx +++ b/src/content/docs/workers/examples/logging-headers.mdx @@ -18,6 +18,8 @@ sidebar: description: Examine the contents of a Headers object by logging to console with a Map. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/logging-headers) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/modify-request-property.mdx b/src/content/docs/workers/examples/modify-request-property.mdx index 13a888c1296fddc..58300a6ed912731 100644 --- a/src/content/docs/workers/examples/modify-request-property.mdx +++ b/src/content/docs/workers/examples/modify-request-property.mdx @@ -17,6 +17,8 @@ description: Create a modified request with edited properties based off of an incoming request. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/modify-request-property) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/modify-response.mdx b/src/content/docs/workers/examples/modify-response.mdx index 5ecc7de99f8021f..295703069204cbe 100644 --- a/src/content/docs/workers/examples/modify-response.mdx +++ b/src/content/docs/workers/examples/modify-response.mdx @@ -17,6 +17,8 @@ description: Fetch and modify response properties which are immutable by creating a copy first. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/modify-response) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/multiple-cron-triggers.mdx b/src/content/docs/workers/examples/multiple-cron-triggers.mdx index e2e9ed888bf4050..2b5bb8b84254ea7 100644 --- a/src/content/docs/workers/examples/multiple-cron-triggers.mdx +++ b/src/content/docs/workers/examples/multiple-cron-triggers.mdx @@ -13,6 +13,8 @@ sidebar: description: Set multiple Cron Triggers on three different schedules. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/multiple-cron-triggers) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/openai-sdk-streaming.mdx b/src/content/docs/workers/examples/openai-sdk-streaming.mdx index 76ae5af6accdfc3..4caef22010df4b9 100644 --- a/src/content/docs/workers/examples/openai-sdk-streaming.mdx +++ b/src/content/docs/workers/examples/openai-sdk-streaming.mdx @@ -14,6 +14,8 @@ head: [] description: Use the OpenAI v4 SDK to stream responses from OpenAI. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/openai-sdk-streaming) + import { TabItem, Tabs } from "~/components"; In order to run this code, you must install the OpenAI SDK by running `npm i openai`. diff --git a/src/content/docs/workers/examples/post-json.mdx b/src/content/docs/workers/examples/post-json.mdx index f088344d09b1e4f..3dae3809364849c 100644 --- a/src/content/docs/workers/examples/post-json.mdx +++ b/src/content/docs/workers/examples/post-json.mdx @@ -14,6 +14,8 @@ sidebar: description: Send a POST request with JSON data. Use to share data with external servers. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/post-json) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/protect-against-timing-attacks.mdx b/src/content/docs/workers/examples/protect-against-timing-attacks.mdx index 805f7240327472e..58adcc8359307a8 100644 --- a/src/content/docs/workers/examples/protect-against-timing-attacks.mdx +++ b/src/content/docs/workers/examples/protect-against-timing-attacks.mdx @@ -16,6 +16,8 @@ description: Protect against timing attacks by safely comparing values using `timingSafeEqual`. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/protect-against-timing-attacks) + import { TabItem, Tabs } from "~/components"; The [`crypto.subtle.timingSafeEqual`](/workers/runtime-apis/web-crypto/#timingsafeequal) function compares two values using a constant-time algorithm. The time taken is independent of the contents of the values. diff --git a/src/content/docs/workers/examples/read-post.mdx b/src/content/docs/workers/examples/read-post.mdx index 78742f50535721f..c9eb3573af78b5f 100644 --- a/src/content/docs/workers/examples/read-post.mdx +++ b/src/content/docs/workers/examples/read-post.mdx @@ -17,6 +17,8 @@ description: Serve an HTML form, then read POST requests. Use also to read JSON or POST data from an incoming request. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/read-post) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/redirect.mdx b/src/content/docs/workers/examples/redirect.mdx index d217581ccc2243f..a9790d6e1fb08f9 100644 --- a/src/content/docs/workers/examples/redirect.mdx +++ b/src/content/docs/workers/examples/redirect.mdx @@ -20,6 +20,8 @@ description: Redirect requests from one URL to another or from one set of URLs to another set. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/redirect) + import { Render, TabItem, Tabs } from "~/components"; ## Redirect all requests to one URL diff --git a/src/content/docs/workers/examples/respond-with-another-site.mdx b/src/content/docs/workers/examples/respond-with-another-site.mdx index 432155e08ddc8c7..941d7385b10f03c 100644 --- a/src/content/docs/workers/examples/respond-with-another-site.mdx +++ b/src/content/docs/workers/examples/respond-with-another-site.mdx @@ -19,6 +19,8 @@ description: Respond to the Worker request with the response from another website (example.com in this example). --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/respond-with-another-site) + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/return-html.mdx b/src/content/docs/workers/examples/return-html.mdx index 09a0caa5dc3c080..5e9f82560e41f26 100644 --- a/src/content/docs/workers/examples/return-html.mdx +++ b/src/content/docs/workers/examples/return-html.mdx @@ -18,6 +18,8 @@ sidebar: description: Deliver an HTML page from an HTML string directly inside the Worker script. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/return-html) + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/return-json.mdx b/src/content/docs/workers/examples/return-json.mdx index 2c791d520c67bd9..e563e6b1bac60d4 100644 --- a/src/content/docs/workers/examples/return-json.mdx +++ b/src/content/docs/workers/examples/return-json.mdx @@ -21,6 +21,8 @@ description: Return JSON directly from a Worker script, useful for building APIs and middleware. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/return-json) + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/rewrite-links.mdx b/src/content/docs/workers/examples/rewrite-links.mdx index ceccb897d533a2d..98609b882fe92ea 100644 --- a/src/content/docs/workers/examples/rewrite-links.mdx +++ b/src/content/docs/workers/examples/rewrite-links.mdx @@ -14,6 +14,8 @@ description: Rewrite URL links in HTML using the HTMLRewriter. This is useful for JAMstack websites. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/rewrite-links) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/security-headers.mdx b/src/content/docs/workers/examples/security-headers.mdx index 9b0a42dad691d6f..ec7ee26b68d20ac 100644 --- a/src/content/docs/workers/examples/security-headers.mdx +++ b/src/content/docs/workers/examples/security-headers.mdx @@ -20,6 +20,8 @@ description: Set common security headers (X-XSS-Protection, X-Frame-Options, Strict-Transport-Security, Content-Security-Policy). --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/security-headers) + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/signing-requests.mdx b/src/content/docs/workers/examples/signing-requests.mdx index ebbd9b5c57d68d4..52819d8e96351d1 100644 --- a/src/content/docs/workers/examples/signing-requests.mdx +++ b/src/content/docs/workers/examples/signing-requests.mdx @@ -18,6 +18,8 @@ sidebar: description: Verify a signed request using the HMAC and SHA-256 algorithms or return a 403. --- +[![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/signing-requests) + import { TabItem, Tabs } from "~/components"; :::note From 165333fd8b83383f9029c1e14d32a859115d251f Mon Sep 17 00:00:00 2001 From: Lucas Kostka Date: Fri, 25 Apr 2025 16:26:42 +0200 Subject: [PATCH 2/2] Added explainer for D2CF button --- src/content/docs/workers/examples/103-early-hints.mdx | 4 ++++ .../docs/workers/examples/accessing-the-cloudflare-object.mdx | 4 ++++ src/content/docs/workers/examples/aggregate-requests.mdx | 4 ++++ src/content/docs/workers/examples/alter-headers.mdx | 4 ++++ src/content/docs/workers/examples/cache-api.mdx | 4 ++++ src/content/docs/workers/examples/cache-post-request.mdx | 4 ++++ src/content/docs/workers/examples/cache-tags.mdx | 4 ++++ src/content/docs/workers/examples/cache-using-fetch.mdx | 4 ++++ src/content/docs/workers/examples/conditional-response.mdx | 4 ++++ src/content/docs/workers/examples/cors-header-proxy.mdx | 4 ++++ src/content/docs/workers/examples/country-code-redirect.mdx | 4 ++++ src/content/docs/workers/examples/cron-trigger.mdx | 4 ++++ src/content/docs/workers/examples/data-loss-prevention.mdx | 4 ++++ src/content/docs/workers/examples/debugging-logs.mdx | 4 ++++ src/content/docs/workers/examples/extract-cookie-value.mdx | 4 ++++ src/content/docs/workers/examples/fetch-html.mdx | 4 ++++ src/content/docs/workers/examples/fetch-json.mdx | 4 ++++ src/content/docs/workers/examples/geolocation-app-weather.mdx | 4 ++++ .../docs/workers/examples/geolocation-custom-styling.mdx | 4 ++++ src/content/docs/workers/examples/geolocation-hello-world.mdx | 4 ++++ src/content/docs/workers/examples/hot-link-protection.mdx | 4 ++++ src/content/docs/workers/examples/images-workers.mdx | 4 ++++ src/content/docs/workers/examples/logging-headers.mdx | 4 ++++ src/content/docs/workers/examples/modify-request-property.mdx | 4 ++++ src/content/docs/workers/examples/modify-response.mdx | 4 ++++ src/content/docs/workers/examples/multiple-cron-triggers.mdx | 4 ++++ src/content/docs/workers/examples/openai-sdk-streaming.mdx | 4 ++++ src/content/docs/workers/examples/post-json.mdx | 4 ++++ .../docs/workers/examples/protect-against-timing-attacks.mdx | 4 ++++ src/content/docs/workers/examples/read-post.mdx | 4 ++++ src/content/docs/workers/examples/redirect.mdx | 4 ++++ .../docs/workers/examples/respond-with-another-site.mdx | 4 ++++ src/content/docs/workers/examples/return-html.mdx | 4 ++++ src/content/docs/workers/examples/return-json.mdx | 4 ++++ src/content/docs/workers/examples/rewrite-links.mdx | 4 ++++ src/content/docs/workers/examples/security-headers.mdx | 4 ++++ src/content/docs/workers/examples/signing-requests.mdx | 4 ++++ 37 files changed, 148 insertions(+) diff --git a/src/content/docs/workers/examples/103-early-hints.mdx b/src/content/docs/workers/examples/103-early-hints.mdx index 224a035a1e5cdd6..7f9a0a9441721aa 100644 --- a/src/content/docs/workers/examples/103-early-hints.mdx +++ b/src/content/docs/workers/examples/103-early-hints.mdx @@ -15,8 +15,12 @@ sidebar: description: Allow a client to request static assets while waiting for the HTML response. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/103-early-hints) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; `103` Early Hints is an HTTP status code designed to speed up content delivery. When enabled, Cloudflare can cache the `Link` headers marked with preload and/or preconnect from HTML pages and serve them in a `103` Early Hints response before reaching the origin server. Browsers can use these hints to fetch linked assets while waiting for the origin’s final response, dramatically improving page load speeds. diff --git a/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx b/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx index b321f541e518498..2ba610192667841 100644 --- a/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx +++ b/src/content/docs/workers/examples/accessing-the-cloudflare-object.mdx @@ -16,8 +16,12 @@ description: Access custom Cloudflare properties and control how Cloudflare features are applied to every request. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/accessing-the-cloudflare-object) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/aggregate-requests.mdx b/src/content/docs/workers/examples/aggregate-requests.mdx index 82e108619fff769..6a71d850b4894bf 100644 --- a/src/content/docs/workers/examples/aggregate-requests.mdx +++ b/src/content/docs/workers/examples/aggregate-requests.mdx @@ -14,8 +14,12 @@ description: Send two GET request to two urls and aggregates the responses into one response. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/aggregate-requests) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/alter-headers.mdx b/src/content/docs/workers/examples/alter-headers.mdx index f605c0eb13d05ca..62ae516d7027f11 100644 --- a/src/content/docs/workers/examples/alter-headers.mdx +++ b/src/content/docs/workers/examples/alter-headers.mdx @@ -19,8 +19,12 @@ description: Example of how to add, change, or delete headers sent in a request or returned in a response. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/alter-headers) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-api.mdx b/src/content/docs/workers/examples/cache-api.mdx index 4fab6cb7b6801ab..7629a02e36483dc 100644 --- a/src/content/docs/workers/examples/cache-api.mdx +++ b/src/content/docs/workers/examples/cache-api.mdx @@ -15,8 +15,12 @@ sidebar: description: Use the Cache API to store responses in Cloudflare's cache. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-api) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-post-request.mdx b/src/content/docs/workers/examples/cache-post-request.mdx index 0a50f9ec47a2b79..b10950487ed5d37 100644 --- a/src/content/docs/workers/examples/cache-post-request.mdx +++ b/src/content/docs/workers/examples/cache-post-request.mdx @@ -15,8 +15,12 @@ sidebar: description: Cache POST requests using the Cache API. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-post-request) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-tags.mdx b/src/content/docs/workers/examples/cache-tags.mdx index 3602a7713c21b66..833766df11b7297 100644 --- a/src/content/docs/workers/examples/cache-tags.mdx +++ b/src/content/docs/workers/examples/cache-tags.mdx @@ -14,8 +14,12 @@ sidebar: description: Send Additional Cache Tags using Workers --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-tags) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cache-using-fetch.mdx b/src/content/docs/workers/examples/cache-using-fetch.mdx index ef6af5bf0d523db..3c8efe2cc104711 100644 --- a/src/content/docs/workers/examples/cache-using-fetch.mdx +++ b/src/content/docs/workers/examples/cache-using-fetch.mdx @@ -18,8 +18,12 @@ description: Determine how to cache a resource by setting TTLs, custom cache keys, and cache headers in a fetch request. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cache-using-fetch) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/conditional-response.mdx b/src/content/docs/workers/examples/conditional-response.mdx index ce7cd03e1929ce6..bc53cd2bc5f837e 100644 --- a/src/content/docs/workers/examples/conditional-response.mdx +++ b/src/content/docs/workers/examples/conditional-response.mdx @@ -16,8 +16,12 @@ description: Return a response based on the incoming request's URL, HTTP method, User Agent, IP address, ASN or device type. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/conditional-response) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cors-header-proxy.mdx b/src/content/docs/workers/examples/cors-header-proxy.mdx index f0ea06f4d3d176c..34f467d6e5db1b6 100644 --- a/src/content/docs/workers/examples/cors-header-proxy.mdx +++ b/src/content/docs/workers/examples/cors-header-proxy.mdx @@ -16,8 +16,12 @@ sidebar: description: Add the necessary CORS headers to a third party API response. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cors-header-proxy) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/country-code-redirect.mdx b/src/content/docs/workers/examples/country-code-redirect.mdx index eaaf62d80f4e864..2b0aead8ddebf52 100644 --- a/src/content/docs/workers/examples/country-code-redirect.mdx +++ b/src/content/docs/workers/examples/country-code-redirect.mdx @@ -17,8 +17,12 @@ sidebar: description: Redirect a response based on the country code in the header of a visitor. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/country-code-redirect) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/cron-trigger.mdx b/src/content/docs/workers/examples/cron-trigger.mdx index f09b6a89adf0c62..2830216b5d45c28 100644 --- a/src/content/docs/workers/examples/cron-trigger.mdx +++ b/src/content/docs/workers/examples/cron-trigger.mdx @@ -13,8 +13,12 @@ sidebar: description: Set a Cron Trigger for your Worker. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/cron-trigger) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { Render, TabItem, Tabs, WranglerConfig } from "~/components"; diff --git a/src/content/docs/workers/examples/data-loss-prevention.mdx b/src/content/docs/workers/examples/data-loss-prevention.mdx index ebd7c17aeaa39e4..cf214ba7a08ff0a 100644 --- a/src/content/docs/workers/examples/data-loss-prevention.mdx +++ b/src/content/docs/workers/examples/data-loss-prevention.mdx @@ -16,8 +16,12 @@ description: Protect sensitive data to prevent data loss, and send alerts to a webhooks server in the event of a data breach. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/data-loss-prevention) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/debugging-logs.mdx b/src/content/docs/workers/examples/debugging-logs.mdx index cfe999c98f55376..378d9d8ab1631f7 100644 --- a/src/content/docs/workers/examples/debugging-logs.mdx +++ b/src/content/docs/workers/examples/debugging-logs.mdx @@ -14,8 +14,12 @@ sidebar: description: Send debugging information in an errored response to a logging service. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/debugging-logs) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/extract-cookie-value.mdx b/src/content/docs/workers/examples/extract-cookie-value.mdx index 7d4e70b606f29f6..f9fb740749825b0 100644 --- a/src/content/docs/workers/examples/extract-cookie-value.mdx +++ b/src/content/docs/workers/examples/extract-cookie-value.mdx @@ -16,8 +16,12 @@ description: Given the cookie name, get the value of a cookie. You can also use cookies for A/B testing. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/extract-cookie-value) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/fetch-html.mdx b/src/content/docs/workers/examples/fetch-html.mdx index de2123fba58ddfb..daac9f38d31e826 100644 --- a/src/content/docs/workers/examples/fetch-html.mdx +++ b/src/content/docs/workers/examples/fetch-html.mdx @@ -17,8 +17,12 @@ description: Send a request to a remote server, read HTML from the response, and serve that HTML. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/fetch-html) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/fetch-json.mdx b/src/content/docs/workers/examples/fetch-json.mdx index ca468bf7893ecd7..7545542204b80b9 100644 --- a/src/content/docs/workers/examples/fetch-json.mdx +++ b/src/content/docs/workers/examples/fetch-json.mdx @@ -16,8 +16,12 @@ description: Send a GET request and read in JSON from the response. Use to fetch external data. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/fetch-json) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/geolocation-app-weather.mdx b/src/content/docs/workers/examples/geolocation-app-weather.mdx index c0232500e123679..88c34f287c9803b 100644 --- a/src/content/docs/workers/examples/geolocation-app-weather.mdx +++ b/src/content/docs/workers/examples/geolocation-app-weather.mdx @@ -14,8 +14,12 @@ sidebar: description: Fetch weather data from an API using the user's geolocation data. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/geolocation-app-weather) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/geolocation-custom-styling.mdx b/src/content/docs/workers/examples/geolocation-custom-styling.mdx index 39baadb5888bd9c..d88b6221d4ea98d 100644 --- a/src/content/docs/workers/examples/geolocation-custom-styling.mdx +++ b/src/content/docs/workers/examples/geolocation-custom-styling.mdx @@ -13,8 +13,12 @@ sidebar: description: Personalize website styling based on localized user time. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/geolocation-custom-styling) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/geolocation-hello-world.mdx b/src/content/docs/workers/examples/geolocation-hello-world.mdx index 9849a745cbb1994..7b74983668c5c6e 100644 --- a/src/content/docs/workers/examples/geolocation-hello-world.mdx +++ b/src/content/docs/workers/examples/geolocation-hello-world.mdx @@ -16,8 +16,12 @@ sidebar: description: Get all geolocation data fields and display them in HTML. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/geolocation-hello-world) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/hot-link-protection.mdx b/src/content/docs/workers/examples/hot-link-protection.mdx index 0bf2e982d38918c..82f42918f8a020d 100644 --- a/src/content/docs/workers/examples/hot-link-protection.mdx +++ b/src/content/docs/workers/examples/hot-link-protection.mdx @@ -17,8 +17,12 @@ description: Block other websites from linking to your content. This is useful for protecting images. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/hot-link-protection) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/images-workers.mdx b/src/content/docs/workers/examples/images-workers.mdx index 94008560cfbcad6..ca0b05bc89cc5e1 100644 --- a/src/content/docs/workers/examples/images-workers.mdx +++ b/src/content/docs/workers/examples/images-workers.mdx @@ -14,8 +14,12 @@ description: Set up custom domain for Images using a Worker or serve images using a prefix path and Cloudflare registered domain. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/images-workers) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; To serve images from a custom domain: diff --git a/src/content/docs/workers/examples/logging-headers.mdx b/src/content/docs/workers/examples/logging-headers.mdx index 50aa3e979f684ef..787f7f4d99f9287 100644 --- a/src/content/docs/workers/examples/logging-headers.mdx +++ b/src/content/docs/workers/examples/logging-headers.mdx @@ -18,8 +18,12 @@ sidebar: description: Examine the contents of a Headers object by logging to console with a Map. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/logging-headers) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/modify-request-property.mdx b/src/content/docs/workers/examples/modify-request-property.mdx index 58300a6ed912731..6a22a56106c34a5 100644 --- a/src/content/docs/workers/examples/modify-request-property.mdx +++ b/src/content/docs/workers/examples/modify-request-property.mdx @@ -17,8 +17,12 @@ description: Create a modified request with edited properties based off of an incoming request. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/modify-request-property) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/modify-response.mdx b/src/content/docs/workers/examples/modify-response.mdx index 295703069204cbe..50caabd0a42489f 100644 --- a/src/content/docs/workers/examples/modify-response.mdx +++ b/src/content/docs/workers/examples/modify-response.mdx @@ -17,8 +17,12 @@ description: Fetch and modify response properties which are immutable by creating a copy first. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/modify-response) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/multiple-cron-triggers.mdx b/src/content/docs/workers/examples/multiple-cron-triggers.mdx index 2b5bb8b84254ea7..ed3df87f3e98f66 100644 --- a/src/content/docs/workers/examples/multiple-cron-triggers.mdx +++ b/src/content/docs/workers/examples/multiple-cron-triggers.mdx @@ -13,8 +13,12 @@ sidebar: description: Set multiple Cron Triggers on three different schedules. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/multiple-cron-triggers) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/openai-sdk-streaming.mdx b/src/content/docs/workers/examples/openai-sdk-streaming.mdx index 4caef22010df4b9..a84650debf1fe1e 100644 --- a/src/content/docs/workers/examples/openai-sdk-streaming.mdx +++ b/src/content/docs/workers/examples/openai-sdk-streaming.mdx @@ -14,8 +14,12 @@ head: [] description: Use the OpenAI v4 SDK to stream responses from OpenAI. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/openai-sdk-streaming) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; In order to run this code, you must install the OpenAI SDK by running `npm i openai`. diff --git a/src/content/docs/workers/examples/post-json.mdx b/src/content/docs/workers/examples/post-json.mdx index 3dae3809364849c..65b97dfcedea1a0 100644 --- a/src/content/docs/workers/examples/post-json.mdx +++ b/src/content/docs/workers/examples/post-json.mdx @@ -14,8 +14,12 @@ sidebar: description: Send a POST request with JSON data. Use to share data with external servers. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/post-json) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/protect-against-timing-attacks.mdx b/src/content/docs/workers/examples/protect-against-timing-attacks.mdx index 58adcc8359307a8..8591e2776eb8e9c 100644 --- a/src/content/docs/workers/examples/protect-against-timing-attacks.mdx +++ b/src/content/docs/workers/examples/protect-against-timing-attacks.mdx @@ -16,8 +16,12 @@ description: Protect against timing attacks by safely comparing values using `timingSafeEqual`. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/protect-against-timing-attacks) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; The [`crypto.subtle.timingSafeEqual`](/workers/runtime-apis/web-crypto/#timingsafeequal) function compares two values using a constant-time algorithm. The time taken is independent of the contents of the values. diff --git a/src/content/docs/workers/examples/read-post.mdx b/src/content/docs/workers/examples/read-post.mdx index c9eb3573af78b5f..d22734aef7d64d7 100644 --- a/src/content/docs/workers/examples/read-post.mdx +++ b/src/content/docs/workers/examples/read-post.mdx @@ -17,8 +17,12 @@ description: Serve an HTML form, then read POST requests. Use also to read JSON or POST data from an incoming request. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/read-post) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/redirect.mdx b/src/content/docs/workers/examples/redirect.mdx index a9790d6e1fb08f9..079a897e56609d8 100644 --- a/src/content/docs/workers/examples/redirect.mdx +++ b/src/content/docs/workers/examples/redirect.mdx @@ -20,8 +20,12 @@ description: Redirect requests from one URL to another or from one set of URLs to another set. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/redirect) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { Render, TabItem, Tabs } from "~/components"; ## Redirect all requests to one URL diff --git a/src/content/docs/workers/examples/respond-with-another-site.mdx b/src/content/docs/workers/examples/respond-with-another-site.mdx index 941d7385b10f03c..de8df3965a4f2fb 100644 --- a/src/content/docs/workers/examples/respond-with-another-site.mdx +++ b/src/content/docs/workers/examples/respond-with-another-site.mdx @@ -19,8 +19,12 @@ description: Respond to the Worker request with the response from another website (example.com in this example). --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/respond-with-another-site) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/return-html.mdx b/src/content/docs/workers/examples/return-html.mdx index 5e9f82560e41f26..c0f3a832cd673fa 100644 --- a/src/content/docs/workers/examples/return-html.mdx +++ b/src/content/docs/workers/examples/return-html.mdx @@ -18,8 +18,12 @@ sidebar: description: Deliver an HTML page from an HTML string directly inside the Worker script. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/return-html) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/return-json.mdx b/src/content/docs/workers/examples/return-json.mdx index e563e6b1bac60d4..4d2a744d8024920 100644 --- a/src/content/docs/workers/examples/return-json.mdx +++ b/src/content/docs/workers/examples/return-json.mdx @@ -21,8 +21,12 @@ description: Return JSON directly from a Worker script, useful for building APIs and middleware. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/return-json) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { Render, TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/rewrite-links.mdx b/src/content/docs/workers/examples/rewrite-links.mdx index 98609b882fe92ea..0748c650611d828 100644 --- a/src/content/docs/workers/examples/rewrite-links.mdx +++ b/src/content/docs/workers/examples/rewrite-links.mdx @@ -14,8 +14,12 @@ description: Rewrite URL links in HTML using the HTMLRewriter. This is useful for JAMstack websites. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/rewrite-links) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/security-headers.mdx b/src/content/docs/workers/examples/security-headers.mdx index ec7ee26b68d20ac..2de1b4ece617536 100644 --- a/src/content/docs/workers/examples/security-headers.mdx +++ b/src/content/docs/workers/examples/security-headers.mdx @@ -20,8 +20,12 @@ description: Set common security headers (X-XSS-Protection, X-Frame-Options, Strict-Transport-Security, Content-Security-Policy). --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/security-headers) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; diff --git a/src/content/docs/workers/examples/signing-requests.mdx b/src/content/docs/workers/examples/signing-requests.mdx index 52819d8e96351d1..021eaee48596cda 100644 --- a/src/content/docs/workers/examples/signing-requests.mdx +++ b/src/content/docs/workers/examples/signing-requests.mdx @@ -18,8 +18,12 @@ sidebar: description: Verify a signed request using the HMAC and SHA-256 algorithms or return a 403. --- +If you want to get started quickly, click on the button below. + [![Deploy to Cloudflare](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/cloudflare/docs-examples/tree/main/workers/signing-requests) +This creates a repository in your GitHub account and deploys the application to Cloudflare Workers. + import { TabItem, Tabs } from "~/components"; :::note