kyle
kyle
CDCloudflare Developers
Created by kyle on 8/23/2024 in #pages-help
Avoiding deploying in Russia
Is there a way to avoid deploying in Russia (ie Russian users can connect to an edge server that's located outside Russia)? Asking because my NextJS backend uses the OpenAI API, and it doesn't work in Russia. Russian users can access our site, but they're missing functionality because the OAI API calls are blocked from the backend. I'm presuming this is because Russian users are hitting an edge deployment located in Russia. Maybe Load Balancer can deal with this?
3 replies
CDCloudflare Developers
Created by kyle on 8/5/2024 in #pages-help
Default maxDuration for next-on-pages?
When hosting on Vercel, there is a tier-based max duration which can be set via the maxDuration config: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config#maxduration Does this maxDuration config have any affect on next-on-pages? Is there a default maxDuration if none is set?
1 replies
CDCloudflare Developers
Created by kyle on 7/23/2024 in #pages-help
caches not found for next on pages
I'm following the cache guide to implement caching with NextJS, however I'm getting caches is not defined inside my route handler. What's the correct way to access the cache API in Next? And is this expected to work locally?
// Cloudflare caching
const cache = caches.default
const cacheRequest = generateCloudflareCacheRequest({
request,
function_handle,
prompt_updated_at: functionData.prompt_updated_at,
})
let cacheResponse = null
try {
cacheResponse = await cache.match(cacheRequest)
} catch (e) {
logError('[serious] Error fetching CF cache', { e, cacheRequest })
}
// Cloudflare caching
const cache = caches.default
const cacheRequest = generateCloudflareCacheRequest({
request,
function_handle,
prompt_updated_at: functionData.prompt_updated_at,
})
let cacheResponse = null
try {
cacheResponse = await cache.match(cacheRequest)
} catch (e) {
logError('[serious] Error fetching CF cache', { e, cacheRequest })
}
4 replies
CDCloudflare Developers
Created by kyle on 7/17/2024 in #pages-help
Best place for viewing production logs? Moving from Vercel
No description
9 replies
CDCloudflare Developers
Created by kyle on 7/17/2024 in #pages-help
Pages/Workers not picking up NextJS .env vars
I'm trying to deploy a NextJS-based Page (+ route handlers which iiuc are deployed as Workers), and it doesn't seem to be picking up my .env vars. It only works if I input them manually into the dashboard. Weird because the build logs always says it pulls in .env. Do I need to use .toml or something?
9 replies
CDCloudflare Developers
Created by kyle on 7/17/2024 in #pages-help
New to pages. Trying to understand how to add rating limiting / IP banning etc
Hello! I'm new to hosting on CF. I'm used to using the security/perf/ddos features for other websites, but I'm having a bit of trouble understand how Pages works with the network features. After I've deployed a site via Pages, and if I assign a CF domain to the Page, do I then configure the domain-specific network features separately from the Pages/Worker stuff? Mostly trying to understand the layout of the dashboard. There's a ton of stuff. Thank you!
3 replies