Spuckwaffel
Spuckwaffel
Explore posts from servers
CDCloudflare Developers
Created by Spuckwaffel on 9/1/2024 in #general-help
Client SSL Public Key Pinning
Hey there, I would like to pin a public key in my clients application to ensure the HTTPS connection only gets established when the public key matches. It currently works fine, however it seems like the public key of my server changes very frequently and randomly (sometimes every few days, sometimes every week), most likely a issue in my cloudflare settings, but I expected that the public key only changes every year or half year, only when i have to pay the 9$ for the domain to not expire. Any ideas how i can change my cloudflare certificate settings to mot change the public key so frequently?
13 replies
CDCloudflare Developers
Created by Spuckwaffel on 5/9/2024 in #general-help
KV or DB?
Hello community, I am familiar with KVs and also do know what the difference between a KV and a DB is and that KVs are way more efficient when it comes to reading with the cost of being not that efficient when writing. However, i am always unsure what to use when i have following: At the moment i store a large JSON which is just an array of a small structure (disabled (bool), gameName (str), gameDescription (str), ID (int)) (10kb) inside a KV because 99% of the query times i just read the contents and 1% is writing into the JSON. However, these 1% still can be a couple thousand queries a week, and currently im still on the free plan and i feel like a DB would work out better. But whenever i change something in the JSON its just a few small fields like "disabled" to true/false, so 99% of the data in the JSON is still the same. This also sounds like something that would be smarter to do in a DB, but then i have the 99% of times where its more efficient to just use the KV. Any ideas what would be smarter to use?
3 replies
CDCloudflare Developers
Created by Spuckwaffel on 3/4/2024 in #workers-help
Downloading file from R2 but unsure what the best method is.
Hey there, newbie here. Ive read several cloudflare docs on how to give users temporary access to a file using signed urls, however i want that the url is only accessible once and not for a short period. The other method would be by using these object.httpEtag attributes but i really dont know how i can use etags in my application, all i could find about etags is that browsers store these tags to either use the file from the cache or download it again, but i dont need any cache at all, i always want to download the file no matter what (i understood the concept of etags, but dont need it, i want to download the file always). My last idea would be to just get the file data within my worker and then just pass the data back in the response, but this kills the cpu time and isnt quite good as a free user. Any idea or examples of a simple eimplementation to fix my issue? I dont wanna rely on any ai prompts but didnt find many resources online (probaby missed some good resources). A one time use link would be perfect.
20 replies
CDCloudflare Developers
Created by Spuckwaffel on 12/31/2023 in #workers-help
use D1 DB in worker (no wrangler etc, just JS)
hey there, noobie here. There are multiple tutorials online how to set up the D1 DB with a worker using wrangler, nodejs etc., however i just want to be able to use all the db related stuff within my js file, so no typescript. I went ahead and added the database via DB Database bindings in the settings of the worker, however any request i do in js returns empty data:
const { results } = await env.DB.prepare('SELECT * FROM user').all();
const json = await Response.json(results);
const jjson = JSON.stringify(json);
console.log(jjson);
const { results } = await env.DB.prepare('SELECT * FROM user').all();
const json = await Response.json(results);
const jjson = JSON.stringify(json);
console.log(jjson);
and yes, the DB is called user, the environment variable in the settings is DB. Am i missing something?
11 replies