Samantas5855
Samantas5855
CDCloudflare Developers
Created by Samantas5855 on 1/11/2024 in #pages-help
Perform fetch request through proxy
I have a VPS which is a proxy server and I would like to connect to it from Pages Functions. I'm looking for a way to perform a fetch request using my http proxy.
2 replies
CDCloudflare Developers
Created by Samantas5855 on 1/10/2024 in #pages-help
ReferenceError: crypto is not defined
I have a javascript file which makes use of crypto. This file is used by both my Cloudflare Pages Functions and my Node preinstall script when running npm i. Locally, on my PC, both run fine but on Cloudflare Pages the preinstall script crashes with ReferenceError: crypto is not defined. If I add
import * as crypto from 'crypto';
import * as crypto from 'crypto';
at the top of the file, the preinstall step will run fine but the Pages Function will fail to build with
The package "crypto" wasn't found on the file system but is built into node. Add the "nodejs_compat" compatibility flag to your Pages project to enable Node.js compatibility.
The package "crypto" wasn't found on the file system but is built into node. Add the "nodejs_compat" compatibility flag to your Pages project to enable Node.js compatibility.
I do have the nodejs_compat flag enabled. Is there any way to not have to use
import * as crypto from 'crypto';
import * as crypto from 'crypto';
since this isn't required when running the preinstall script on my PC?
8 replies
CDCloudflare Developers
Created by Samantas5855 on 11/2/2023 in #pages-help
Adding headers to Response.json
As the title suggests, would it be possible to add CORS headers to the response when using Response.json?
2 replies
CDCloudflare Developers
Created by Samantas5855 on 10/24/2023 in #pages-help
Cache isn't always hit
Following the example at https://developers.cloudflare.com/workers/examples/cache-api/ we implemented the Cache API on our Pages Function. Few changes were made, for example instead of s-maxage, Expires was used. The endpoint that uses the cache is only accessed by our app not web browsers. When looking at the console logs we figured that not every request hits the cache, it's roughly about a 50% hit rate. Is this the expected behavior or can the hit rate be improved somehow?
3 replies
CDCloudflare Developers
Created by Samantas5855 on 10/21/2023 in #pages-help
Rate limit per ip
Is it possible to rate limit an ip? Today an obscure bug in our app caused a single ip to spam requests.
3 replies
CDCloudflare Developers
Created by Samantas5855 on 9/13/2023 in #pages-help
Caching to save on request quota
Hi, We are developing an API powered by Pages and Functions. We get many requests with the same parameter which get the same response every time (but they can't be served statically). Is it possible to cache the response based on the url and params to save on requests quota?
4 replies