- Oct 2023
-
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
- 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
-
```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
-
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
Tags
Annotators
URL
-
- Jun 2023
- May 2023
-
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.
-
- Feb 2023
-
developers.cloudflare.com developers.cloudflare.com
- Nov 2022
-
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
-
- Sep 2022
-
egghead.io egghead.io
- Mar 2022