- Oct 2023
-
community.cloudflare.com community.cloudflare.com
-
stackoverflow.com stackoverflow.com
-
blog.cloudflare.com blog.cloudflare.com
-
While the interface among services is HTTP, the networking is not. In fact, there is no networking! Unlike the typical “microservice architecture,” where services communicate over a network and can suffer from latency or interruption, service bindings are a zero-cost abstraction. When you deploy a service, we build a dependency graph of its service bindings, then package all of those services into a single deployment. When one service invokes another, there is no network delay; the request is executed immediately.This zero-cost model enables teams to share and reuse code within their organizations, without sacrificing latency or performance.
-
-
developers.cloudflare.com developers.cloudflare.com
-
github.com github.com
- Sep 2023
-
blog.cloudflare.com blog.cloudflare.com
- Aug 2023
-
gitlab.com gitlab.com
Tags
Annotators
URL
-
-
community.cloudflare.com community.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
stackoverflow.com stackoverflow.com
-
```toml type = "webpack" webpack_config = "webpack.config.js"
these will be used in production
vars = { WORKER_ENV = "production", SENTRY_ENABLED = true }
[env.local]
these will be used only when --env=local
vars = { WORKER_ENV = "local", SENTRY_ENABLED = false } ```
wrangler dev --env=local
-
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
```js // Auth Worker
export default { async fetch(request, env) { // Read x-custom-token header and make sure it matches SECRET_TOKEN if (request.headers.get('x-custom-token') === env.SECRET_TOKEN) { return new Response('Request allowed', { status: 200 }); } else { return new Response('x-custom-token does not match, request not allowed', { status: 403 }); } }, }; ```
```js // Gateway Worker
export default { async fetch(request, env) { // Fetch AUTH service and pass request const authResponse = await env.auth.fetch(request.clone());
// Return response from the AUTH service if the response status is not 200 // It would return 403 'x-custom-token does not match, request not allowed' response in such case if (authResponse.status !== 200) { return authResponse; } // Request allowed // You can write application logic here // In this case we delegate the logic to an `application` Worker return await env.application.fetch(request)
}, }; ```
-
- Jul 2023
-
jonasclaes.be jonasclaes.be
-
developers.cloudflare.com developers.cloudflare.com
-
kit.svelte.dev kit.svelte.dev
-
kit.svelte.dev kit.svelte.dev
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
-
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
js export default { async tail(events) { fetch("https://example.com/endpoint", { method: "POST", body: JSON.stringify(events), }) } }
-
-
developers.cloudflare.com developers.cloudflare.com
-
bash curl --request PUT \ --url https://api.cloudflare.com/client/v4/accounts/account_identifier/workers/scripts/script_name/schedules \ --header 'Content-Type: application/json' \ --header 'X-Auth-Email: ' \ --data '[{'\''cron'\'': '\''*/30 * * * *'\''}]'
-
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
``` wrangler dev --test-scheduled
$ curl "http://localhost:8787/__scheduled?cron=++++*" ```
-
-
developers.cloudflare.com developers.cloudflare.com
-
js export default { async scheduled(event, env, ctx) { ctx.waitUntil(doSomeTaskOnASchedule()); }, };
-
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
-
demo.mqtt.dev demo.mqtt.dev
Tags
Annotators
URL
-
-
github.com github.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
github.com github.com
-
github.com github.com
-
developers.cloudflare.com developers.cloudflare.com
-
The Hibernation API allows a Durable Object that is not currently running an event handler, such as handling a WebSocket message, HTTP request, or alarm, to be removed from memory while keeping its WebSockets connected (“hibernation”).
-
- Jun 2023
-
www.devever.net www.devever.net
-
Where such denial-of-service conditions occur, Cloudflare provides a bizarre “one more step” page inviting the visitor to complete a reCAPTCHA to access the site. Cloudflare claims that this is based on IP reputation, which constitutes a fallacious equivocation of IPs and users which has been found to be highly detrimental to Tor users in terms of the browseability of the web.
This is a good critique of Cloudflare CAPTCHAs. They are especially annoying when using a VPN (I use Mullvad) or unusual browser configurations. I wrote about how the Wayback Machine provides a good end-around the CAPTCHA deluge for pages which have been captured.
https://thenewleafjournal.com/using-web-archives-to-get-around-captchas/
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
-
cloudflare.tv cloudflare.tv
-
jeffy.info jeffy.info
-
astro-sw-demo.netlify.app astro-sw-demo.netlify.appAstro1
Tags
Annotators
URL
-
- May 2023
-
github.com github.com
-
Workers Types Generator
-
-
github.com github.com
-
Hey! Thanks for raising this. As pointed out earlier in the thread, the workerd npm distribution is currently incompatible with Debian 11 "Bullseye", so won't work with any distro based off that (e.g. Ubuntu 20.04). Debian 12 "Bookworm" based distros (e.g. Ubuntu 22.04) should work, provided you apt install libc++1. We're working on getting a statically linked version of workerd published that should work on older Linux versions. No timeline on when this will be available though.
-
-
github.com github.com
-
Figured it out. Cache-Control header is required.
js const headers = { 'Cache-Control': 'public, max-age=604800' }; const request = new Request('https://foobar.com/') const cacheResponse = new Response('bar',{ headers }) const cache = caches.default await cache.put(request, cacheResponse) const response = await cache.match(request);
-
-
developers.cloudflare.com developers.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
-
🥳
```js import { connect } from 'cloudflare:sockets';
export default { async fetch(req: Request) { const gopherAddr = "gopher.floodgap.com:70"; const url = new URL(req.url);
try { const socket = connect(gopherAddr); const writer = socket.writable.getWriter() const encoder = new TextEncoder(); const encoded = encoder.encode(url.pathname + "\r\n"); await writer.write(encoded); return new Response(socket.readable, { headers: { "Content-Type": "text/plain" } }); } catch (error) { return new Response("Socket connection failed: " + error, { status: 500 }); }
} };
ts connect(address: SocketAddress | string, options?: SocketOptions): Socket
declare interface Socket { get readable(): ReadableStream; get writable(): WritableStream; get closed(): Promise<void>; close(): Promise<void>; startTls(): Socket; }
declare interface SocketOptions { secureTransport?: string; allowHalfOpen: boolean; }
declare interface SocketAddress { hostname: string; port: number; } ```
-
-
developers.cloudflare.com developers.cloudflare.com
- Apr 2023
-
github.com github.com
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
- Mar 2023
-
developers.cloudflare.com developers.cloudflare.com
-
<table><tbody><tr><th colspan="4" rowspan="1">Status</th><th colspan="4" rowspan="1">Description</th></tr><tr><td colspan="5" rowspan="1">HIT</td><td colspan="5" rowspan="1">The resource was found in Cloudflare’s cache.</td></tr><tr><td colspan="5" rowspan="1">MISS</td><td colspan="5" rowspan="1">The resource was not found in Cloudflare’s cache and was served from the origin web server.</td></tr><tr><td colspan="5" rowspan="1">NONE/UNKNOWN</td><td colspan="5" rowspan="1">Cloudflare generated a response that denotes the asset is not eligible for caching. This may have happened because:
- A Worker generated a response without sending any subrequests. In this case, the response did not come from cache, so the cache status will be
none/unknown
.- A Worker request made a subrequest (
fetch
). In this case, the subrequest will be logged with a cache status, while the main request will be logged withnone/unknown
status (the main request did not hit cache, since Workers sits in front of cache).- A Firewall rule was triggered to block a request. The response will come from the edge network before it hits cache. Since there is no cache status, Cloudflare will log as
none/unknown
.- A redirect page rule caused the edge network to respond with a redirect to another asset/URL. This redirect response happens before the request reaches cache, so the cache status is
</td></tr><tr><td colspan="5" rowspan="1">EXPIRED</td><td colspan="5" rowspan="1">The resource was found in Cloudflare’s cache but was expired and served from the origin web server.</td></tr><tr><td colspan="5" rowspan="1">STALE</td><td colspan="5" rowspan="1">The resource was served from Cloudflare’s cache but was expired. Cloudflare could not contact the origin to retrieve an updated resource.</td></tr><tr><td colspan="5" rowspan="1">BYPASS</td><td colspan="5" rowspan="1">The origin server instructed Cloudflare to bypass cache via a Cache-Control header set tonone/unknown
.no-cache
,private
, ormax-age=0
even though Cloudflare originally preferred to cache the asset. BYPASS is returned when enabling Origin Cache-Control. Cloudflare also sets BYPASS when your origin web server sends cookies in the response header.</td></tr><tr><td colspan="5" rowspan="1">REVALIDATED</td><td colspan="5" rowspan="1">The resource is served from Cloudflare’s cache but is stale. The resource was revalidated by either anIf-Modified-Since
header or anIf-None-Match header
.</td></tr><tr><td colspan="5" rowspan="1">UPDATING</td><td colspan="5" rowspan="1">The resource was served from Cloudflare’s cache and was expired, but the origin web server is updating the resource. UPDATING is typically only seen for very popular cached resources.</td></tr><tr><td colspan="5" rowspan="1">DYNAMIC</td><td colspan="5" rowspan="1">Cloudflare does not consider the asset eligible to cache and your Cloudflare settings do not explicitly instruct Cloudflare to cache the asset. Instead, the asset was requested from the origin web server. Use Page Rules to implement custom caching options.</td></tr></tbody></table> - A Worker generated a response without sending any subrequests. In this case, the response did not come from cache, so the cache status will be
-
-
workers.tools workers.tools
-
HTML templating and streaming response library for Worker Runtimes such as Cloudflare Workers.
js function handleRequest(event: FetchEvent) { return new HTMLResponse(pageLayout('Hello World!', html` <h1>Hello World!</h1> ${async () => { const timeStamp = new Date( await fetch('https://time.api/now').then(r => r.text()) ); return html`<p>The current time is ${timeEl(timeStamp)}.</p>` }} `)); }
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
-
www.cloudflare.com www.cloudflare.com
-
support.cloudflare.com support.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
- Feb 2023
-
github.com github.com
-
```js import type { EntryContext } from "@remix-run/cloudflare"; import { RemixServer } from "@remix-run/react"; import isbot from "isbot"; import { renderToReadableStream } from "react-dom/server";
const ABORT_DELAY = 5000;
const handleRequest = async ( request: Request, responseStatusCode: number, responseHeaders: Headers, remixContext: EntryContext ) => { let didError = false;
const stream = await renderToReadableStream( <RemixServer context={remixContext} url={request.url} abortDelay={ABORT_DELAY} />, { onError: (error: unknown) => { didError = true; console.error(error);
// You can also log crash/error report }, signal: AbortSignal.timeout(ABORT_DELAY), }
);
if (isbot(request.headers.get("user-agent"))) { await stream.allReady; }
responseHeaders.set("Content-Type", "text/html"); return new Response(stream, { headers: responseHeaders, status: didError ? 500 : responseStatusCode, }); };
export default handleRequest; ```
-
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
- Jan 2023
-
blog.cloudflare.com blog.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
- Dec 2022
-
-
-
webauthn.qwtel.workers.dev webauthn.qwtel.workers.dev
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
www.cloudflare.com www.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
-
dev.to dev.to
-
www.jacobparis.com www.jacobparis.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
-
Conceptually, OHTTP is a simple protocol: end-to-end encrypted requests and responses are forwarded between client and server through a relay, decoupling who from what was sent
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
blog.archive.org blog.archive.org
-
blog.cloudflare.com blog.cloudflare.com
- Nov 2022
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
Pages offers developers the ability to define a _worker.js file in the output directory of your Pages project.
-
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
- Oct 2022
-
workers.tools workers.tools
Tags
Annotators
URL
-
-
levelup.gitconnected.com levelup.gitconnected.com
-
We use Javascript everywhere, since we solve the “issues” caused by Javascript rendering we want to build as much expertise as possible in this field. But for the other parts, we are taking advantage of CloudFlare’s distributed system for fast response and global scalability. While our uptime guarantees are supported by Digital Ocean’s cloud platform. We also use a myriad of other SaaS providers to maximize our effectiveness.
Stack of Prerender: - Javascript - CloudFlare - Digital Ocean - SaaS providers
-
- Sep 2022
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
community.cloudflare.com community.cloudflare.com
-
egghead.io egghead.io
- Aug 2022
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
- Jul 2022
-
developers.cloudflare.com developers.cloudflare.com
-
developers.cloudflare.com developers.cloudflare.com
-
- Go to Settings > Network & internet.
- Select Advanced > Private DNS.
- Select the Private DNS provider hostname option.
- Enter
one.one.one.one
or1dot1dot1dot1.cloudflare-dns.com
and press Save.
Tags
Annotators
URL
-
- Jun 2022
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
-
www.cloudflare.com www.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
developers.cloudflare.com developers.cloudflare.com
-
bash curl --http2 -H 'accept: application/dns-json' https://1.1.1.1/dns-query?name=cloudflare.com --next --http2 -H 'accept: application/dns-json' https://1.1.1.1/dns-query?name=example.com
-
-
miniflare.dev miniflare.dev
-
- May 2022
- Apr 2022
-
developers.cloudflare.com developers.cloudflare.com
-
blog.opstree.com blog.opstree.com
-
developers.cloudflare.com developers.cloudflare.com
-
Cache using fetch
Determine how to cache a resource by setting TTLs, custom cache keys, and cache headers in a fetch request.
```js async function handleRequest(request) { const url = new URL(request.url);
// Only use the path for the cache key, removing query strings // and always store using HTTPS, for example, https://www.example.com/file-uri-here const someCustomKey =
https://${url.hostname}${url.pathname}
;let response = await fetch(request, { cf: { // Always cache this fetch regardless of content type // for a max of 5 seconds before revalidating the resource cacheTtl: 5, cacheEverything: true, //Enterprise only feature, see Cache API for other plans cacheKey: someCustomKey, }, }); // Reconstruct the Response object to make its headers mutable. response = new Response(response.body, response);
// Set cache control headers to cache on browser for 25 minutes response.headers.set('Cache-Control', 'max-age=1500'); return response; }
addEventListener('fetch', event => { return event.respondWith(handleRequest(event.request)); }); ```
Caching HTML resources
Setting the cache level to Cache Everything will override the default cacheability of the asset. For time-to-live (TTL), Cloudflare will still rely on headers set by the origin.
js // Force Cloudflare to cache an asset fetch(event.request, { cf: { cacheEverything: true } });
-
-
www.programmableweb.com www.programmableweb.com
Tags
Annotators
URL
-
-
api.cloudflare.com api.cloudflare.com
-
- Mar 2022
-
-
-
blog.cloudflare.com blog.cloudflare.com
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
blog.cloudflare.com blog.cloudflare.com
-
www.youtube.com www.youtube.com
-
- Feb 2022
-
blog.cloudflare.com blog.cloudflare.com
- Nov 2021
-
developers.cloudflare.com developers.cloudflare.com
Tags
Annotators
URL
-
- Dec 2020
-
developers.cloudflare.com developers.cloudflare.com
- Nov 2020
-
blog.cloudflare.com blog.cloudflare.com
-
Today, we’re excited to open up a beta of a third approach to keeping web browsing safe with Cloudflare Browser Isolation. Browser sessions run in sandboxed environments in Cloudflare data centers in 200 cities around the world, bringing the remote browser milliseconds away from the user so it feels like local web browsing.
Cloudflare introduces sandboxed web browsing. It's like a browser inside a browser, so we can rest assured that we won't be infected by the websites we visit
Tags
Annotators
URL
-
- Jun 2020
-
www.savjee.be www.savjee.be
-
The best all-around performer is AWS CloudFront, followed closely by GitHub Pages. Not only do they have the fastest response times (median), they’re also the most consistent. They are, however, closely followed by Google Cloud Storage. Interestingly, there is very little difference between a regional and multi-regional bucket. The only reason to pick a multi-regional bucket would be the additional uptime guarantee. Cloudflare didn’t perform as well I would’ve expected.
Results of static webhosting benchmark (2020 May):
- AWS CloudFront
- GitHub Pages
- Google Cloud Storage
-
- Feb 2020
-
-
To add insult to injury I learn that when Cloudflare automatically detects an anomaly with your domain they permanently delete all DNS records. Mine won't be difficult to restore, but I'm not sure why this is necessary. Surely it would be possible for Cloudflare to mark a domain as disabled without irrevocably deleting it? Combined with the hacky audit log, I'm left with the opinion that for some reason Cloudflare decided to completely half-ass the part of their system that is responsible for deleting everything that matters to a user.
...and this is why some companies should not grow to become too big for the good of their customers.
Tags
Annotators
URL
-
- Oct 2019
-
support.cloudflare.com support.cloudflare.com
-
Purging by single-file through your Cloudflare dashboard
This seems like the best way to purge files but I wonder if you can purge by domain or rather files rather than file.
-
- Sep 2018
-
blog.cloudflare.com blog.cloudflare.com
Tags
Annotators
URL
-
-
www.cloudflare.com www.cloudflare.com
-
Browse files stored on IPFS easily and securely with Cloudflare’s Distributed Web Gateway without downloading software. Serve your own content hosted on IPFS from a custom domain over HTTPs.
Tags
Annotators
URL
-
- Mar 2017
-
www.wired.com www.wired.com
-
cloud storage service S3, which Amazon confirmed is experiencing “high error rates,”
Need to look at S3
-