Hugo
Hugo
CDCloudflare Developers
Created by Hugo on 9/4/2024 in #general-help
Cache « in-server » requests
No description
2 replies
CDCloudflare Developers
Created by Hugo on 9/3/2024 in #workers-help
Cache external requests
No description
3 replies
CDCloudflare Developers
Created by Hugo on 7/23/2024 in #pages-help
Preview deployments under sub-domains
No description
3 replies
CDCloudflare Developers
Created by Hugo on 7/2/2024 in #general-help
Is Turnstil will work for .pages.dev staging websites?
Refering to these docs: https://developers.cloudflare.com/turnstile/get-started/client-side-rendering/ I'm playing around integrating Turnstile, but I don't want to test things in prod. So I'm working on a staging deployed branche under a .pages.dev domain. So far I got a [400]: https://challenges.cloudflare.com/cdn-cgi/challenge-platform/h/g/flow/ov1/2049655336:1719936617:0_FJQWPXH2YvfItEUoo36yZmg0JzeQT_-42dMLKPpPQ/89cffdc25a9d42db/11ff73d1372fd92 400 (Bad Request) My implementation uses this script tag in the <head/>: <script src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit"></script> And my code is:
if (
response.headers.has('cf-mitigated') &&
response.headers.get('cf-mitigated') === 'challenge'
) {
console.log('Turnstile challenge detected');
await new Promise < void > ((resolve, reject) => {
// @ts-ignore
turnstile.render('#turnstile_widget', {
sitekey: 'XX',
'error-callback': function(e: any) {
console.log('Turnstile error callback triggered');
turnstileOverlay.style.display = 'none';
reject(e);
},
callback: function(token: any, preClearanceObtained: any) {
console.log('Turnstile callback triggered');
if (preClearanceObtained) {
console.log('Pre-clearance obtained');
turnstileOverlay.style.display = 'none';
resolve();
} else {
reject(new Error('Unable to obtain pre-clearance'));
}
}
});
});
}
if (
response.headers.has('cf-mitigated') &&
response.headers.get('cf-mitigated') === 'challenge'
) {
console.log('Turnstile challenge detected');
await new Promise < void > ((resolve, reject) => {
// @ts-ignore
turnstile.render('#turnstile_widget', {
sitekey: 'XX',
'error-callback': function(e: any) {
console.log('Turnstile error callback triggered');
turnstileOverlay.style.display = 'none';
reject(e);
},
callback: function(token: any, preClearanceObtained: any) {
console.log('Turnstile callback triggered');
if (preClearanceObtained) {
console.log('Pre-clearance obtained');
turnstileOverlay.style.display = 'none';
resolve();
} else {
reject(new Error('Unable to obtain pre-clearance'));
}
}
});
});
}
3 replies
CDCloudflare Developers
Created by Hugo on 3/25/2024 in #general-help
Cache server-to-server requests (SvelteKit)
No description
2 replies
CDCloudflare Developers
Created by Hugo on 11/28/2023 in #general-help
Location request headers
No description
2 replies
CDCloudflare Developers
Created by Hugo on 8/10/2023 in #workers-help
How SvelteKit endpoints are handled
Hi there! Does SvelteKit server routes are handled as a Cloudflare Worker? (I mean do I need to pay attention to Node-dependent libs when writing SvelteKit server routes) SvelteKit server routes doc: https://kit.svelte.dev/docs/routing Using SvelteKit functions on Cloudflare Pages doc: https://developers.cloudflare.com/pages/framework-guides/deploy-a-svelte-site/#functions-setup
14 replies
CDCloudflare Developers
Created by Hugo on 5/25/2023 in #general-help
Deploy SvelteKitp app (node version)
2 replies
CDCloudflare Developers
Created by Hugo on 1/25/2023 in #workers-help
Unable to use aws-sdk in production
Hi there! I have a SvelteKit endpoint supposed to be a Worker that use the aws-sdk, everything work well in my other endpoints so Worker adapter and so are configured well. Everything work well in my local dev env too But in the deployed version on Cloudflare Pages I got an 500 internal error message When I remove the import of the aws-sdk, it works, so I assume this is the cause of the error? here's the line that cause the error: import S3 from 'aws-sdk/clients/s3.js'; If this line is on my endpoint, result in "internal error" message. Maybe you have an hint? 🙂
4 replies