gekkepop.
gekkepop.
CDCloudflare Developers
Created by gekkepop. on 7/21/2024 in #workers-help
How to modify websocket request before sending it to durable object
I currently call:
durableObject.fetch(request)
but I want to send it like this:
durableObject.fetch(modifiedRequest)
Where the modifiedRequest is as follows:
let url = new URL(request.url); url.searchParams.append('test', 'test123'); let modifiedRequest = new Request(url, { ...request, });
When I try this I get:
Worker tried to return a WebSocket in a response to a request which did not contain the header "Upgrade: websocket"."
What am I missing?
3 replies
CDCloudflare Developers
Created by gekkepop. on 7/13/2024 in #workers-help
How to rate-limit and only allow request from specific origin for my worker?
Is it possible for my worker to only accept requests from my domain while also limiting the amount of requests people can do from that domain? In my case people can go to my website/domain and press buttons that fire events to my worker, now I want to prevent people from just spamming my worker till my costs explode. Is there any easy way to do this?
7 replies
CDCloudflare Developers
Created by gekkepop. on 6/16/2024 in #workers-help
this.ctx.getWebSockets() return array of empty objects
When I run this.ctx.getWebSockets() from my durableObject it returns me an array of empty objects, but I expected to actually receive the websockets, what am I missing?
29 replies
CDCloudflare Developers
Created by gekkepop. on 5/26/2024 in #workers-help
Understanding Cloudflare websockets costs
Hi there, is there documentation on the costs of using websockets in my worker? I found some old articles, but nothing new and/or clear on what my actual costs are going to be. Like do I incur costs if I keep a connection open? Any help would be appreciated.
2 replies