Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

Possible!?!? - Merging Response Headers and Response Body

Can I get some help merging these two functions into one please? ``` if (STUFF) { response.headers.set(...

Crawler Detection in Cloudflare Worker

Can we revisit this? Any way to detect IF crawler using cloudflare worker on PRO plan?

On a Cloudflare Pages site on a custom

On a Cloudflare Pages site (on a custom domain), I'm making an API request to a Worker (on a custom domain) via fetch(), with cache everything and cachettl set. The response object has some Cloudflare headers on it - cf-priority, cf-ray, server - but no CF-Cache-Status. I was expecting to see that to verify if the request was cached or not. What have I missed, please?...

I was wondering if it is possible to

I was wondering if it is possible to pipe an (image) stream into FormData? I currently have this setup: ```ts const { readable, writable } = new TransformStream(); req.body.pipeTo(writable); ...

I m running into issues trying to

I'm running into issues trying to consume a enscripten-built WASM npm package from a JS worker. are there any examples out there? i see a couple articles from 2018, but they don't seem accurate or focused enough

Probably been discussed a lot but any

Probably been discussed a lot, but any chance worker subrequests can reach other ports than 80/443? The use case is connecting to an external ClickHouse or ElasticSearch database, typically hosted on port 8123 or 9200, without having to have an intermediary router. Tx
They can't unfortunately
Sorry, for digging something up from a couple months ago, but I just stumbled upon this and it seems to blow up my plans for using CF Workers... ...

Stripe

I saw that and it's incredibly exciting. I haven't tested it yet though

Durable objects would be ok for

Durable objects would be ok for matchmaking at a small scale but at larger scale durable objects will quickly start to have some issues that will be pretty complex to try and solve. I would personally recommend using a service dedicated to matchmaking and hosting on an actual server šŸ¤·

Merging Two Workers Together

Need some help merging two worker scripts together. One is a redirect and another alters CSS. Both are working when unmerged. Can someone please help me?

šŸ› BUG: Doing fetch requests in a Worker...

Hi, I have updated my workers and they are using 2.8.1 and now, when I do a env.SERVICE.fetch(request.clone()) it stalls with a " TypeError: Cannot construct a Request with a Request object that has already been used." And it was working before, both in local and deployed in CF....

How come Cloudflare Cache API doesn t

How come Cloudflare Cache API doesn't implement some methods such as keys() etc? Probably a reason why but it doesn't mention it

oh dang so turns out even the beta of

oh dang, so turns out even the beta of email Workers can't access the message body. To get cheap high ish volume inbound email processing, what's your recommendations? AWS SES as well for inbound? https://developers.cloudflare.com/email-routing/email-workers/...

cache API alternatives

One drawback of using KV for the cache is that there is no easy way to purge that cache. With the current approach by using Cache API we put a custom Cache-Tag to a response, let's say category name. And then once we update pages in that category we call CF API to purge cache by that cache tag. There might be a million pages in that category, so we just purge by cache tag and no need to purge cache for each page. Maybe I didn't completely get the idea of the approach used in worker sites (https://blog.cloudflare.com/extending-the-workers-platform/) but looks like it doesn't fit our use case as we can't update millions of pages in KV. I thought maybe we can have different KV namespaces per each category, so when we need to purge the cache - recreate the namespace. There is a limit of 100 namespaces and we might have thousands of categories. ...

With my cloudflare worker I fail with

With my cloudflare worker I fail with the error [mf:err] Cause: RequestContentLengthMismatchError: Request body length does not match content-length header from the following API response: ``` Note: Unnecessary use of -X or --request, POST is already inferred.
content-length: 697 content-type: application/x-www-form-urlencoded...

what s the correct way to consume wasm

what's the correct way to consume wasm for workers? i've been trying the example at https://blog.cloudflare.com/announcing-wasi-on-workers/ with wrangler but it's not happy with import demoWasm from "./demo.wasm"; kind of import (ts complains about a missing loader)

Incremental adoption of micro-frontends ...

I just came across this recent Cloudflare blog post talking about Fragment Piercing. It seems like quite a useful approach for improving a legacy application, but one thing isn't quite clear to me - how do you implement the Piercing Gateway Worker? Specifically, how does the browser know to point to the Piercing Gateway Worker rather than the Legacy Application host/server? Is there a way to point a domain's DNS to a specific CF Worker? Until I found this post, my plan was to just use Workers in conjunction with a client-side Service Worker to intercept requests and manipulate them as necessary. https://blog.cloudflare.com/fragment-piercing/...