Questions tagged [cloudflare-workers]

146 questions
2
votes
1 answer

How to get Angular app working with Cloudflare Workers - Workers Sites

I am struggling to get an SPA working using Angular with Cloudflare's Workers Sites. I am following the tutorial found here (but supplementing steps for Angular- not React), and everything is fine until however once published I am getting the…
2
votes
1 answer

Parse raw body on cloudflare-worker service(Non NODE)

I've created an api server'ish environment on cloudflare using cloudflare-worker and there is no node server running(cloudflare-worker is pretty much serverless event handler service). It does provide the configurations to handle any subdomain calls…
Vectrobyte
  • 1,260
  • 7
  • 25
2
votes
1 answer

How do I query in MongoDB with Cloudflare workers?

I am trying to query mongodb simple findOne in using mongodb. Cloudflare worker is giving 10ms CPU time but during preview/publish throwing error I have tried installing these npm modules npm i mongodb, mongodb-core, dgram, fs var MongoClient =…
2
votes
1 answer

Set more than one cookie in the 'Set-Cookie' header in a cloudflare worker header.set('Set-Cookie' function

I'm trying to use a cloudfare worker to add 2 cookie key/value pairs to the response before sending it to the client. Unfortunately all documentation for the cloudflare workers says to use the response.headers.set('Set-Cookie',xxx) function to set…
Michael
  • 115
  • 1
  • 6
2
votes
1 answer

How to inject javascript in existing HTML response with node.js and cloudflare workers

I have a vanity URL pointing to a GitBook. GitBook doesn't support the insertion of arbitrary javascript snippets. At the moment GitBook has 4 "integrations" only. I could route through my own VM server to accomplish this, but I have CloudFlare and…
Todd
  • 14,946
  • 6
  • 42
  • 56
2
votes
2 answers

What is the best way to stream data in real time into Big Query (using Node)?

I want to stream HTTP requests into BigQuery, in real time (or near real time). Ideally, I would like to use a tool that provides an endpoint to stream HTTP requests to and allows me to write simple Node such that: 1. I can add the appropriate…
2
votes
1 answer

Cloudflare sessions

I wanted to add a feature to my site similar to this: When a new session starts look at the utm_source/utm_medium querystring values and also the referrer. Based on that display a differnt phone number of the site, so for example google cpc, bing…
Ben
  • 559
  • 3
  • 14
2
votes
1 answer

Cloudflare Worker TypeError: One-time-use body

I'm trying to use a Cloudflare Worker to proxy a POST request to another server. It is throwing a JS exception – by wrapping in a try/catch blog I've established that the error is: TypeError: A request with a one-time-use body (it was initialized…
Nick
  • 769
  • 1
  • 8
  • 18
2
votes
1 answer

How not to loose referer value on 301 https redirects in Cloudflare Workers

Am trying to pass Ref(f)erer via 301 redirect from HTTPS domainA to HTTPS domainB using cloudflare workers. 1) User enters https://domainA.com in a browsers address field, such request headers are send to server: This request is then handled by…
2
votes
1 answer

Can I use Cloudflare Workers to batch requests?

I would like to log requests made to my site which travel through Cloudflare. I think I can use Cloudflare Workers to do this, but I don't want to DoS my logging service by making a request to it with every request made to my site. Can I have the…
Zack Bloom
  • 8,059
  • 2
  • 17
  • 26
1
vote
0 answers

How to use environment variables in CloudFlare Worker in local development environment

I have a CloudFlare Worker where I have environment variables set in the CF Settings..Environment Variables interface. I also have this wrangler.toml In my worker's index.js I have code reading the variable REGISTRATION_API_URL. If the code is…
Matthew Nichols
  • 4,257
  • 4
  • 38
  • 44
1
vote
2 answers

Possible to A/B test between two targets under one CNAME?

Is it possible to dynamically route between two targets under one CNAME? I couldn't find any specific documentation where Cloudflare workers or page rules could accomplish this. For context my team is attempting an A/B test between two deployed…
bteng22
  • 41
  • 4
1
vote
3 answers

How can I use Cloudflare workers to optimize TTFB for a static website?

I have a website that is hosted on GitHub Pages, fully static HTML that loads reasonably fast. I have been trying to cut the TTFB Time (as well as FCP, LCP and Fully Loaded). Trying to focus on TTFB now, I made several attempts. Using Cloudflare…
Mo Abdelalim
  • 95
  • 13
1
vote
0 answers

Wordpress redirect to main host

I am looking for a WP php rule to always serve any webpage via the desired host without adding a redirect rule which is not an option in this case. see below. We have our main site on one server and a WordPress installed on another server. We use…
Joel
  • 437
  • 5
  • 16
1
vote
1 answer

How can i upload files to file.io using cloud flare workers[javascript]?

These recent days I tryed multiple times to upload file to file.io using cfworkers but it returns error this is my source code: async function handleRequest() { const file =…
1
2
3
9 10