Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

workers-help

pages-help

general-help

durable-objects

workers-discussions

pages-discussions

wrangler

coding-help

kv

πŸ¦€rust-on-workers

miniflare

stream

general-discussions

functions

zaraz

⚑instant-logs

email-routing

r2

pubsub-beta

analytics-engine

d1-database

queues

workers-for-platforms

workerd

web3

πŸ€–turnstile

radar

web-research

logs-engine

cloudflare-go

terraform-provider-cloudflare

workers-ai

browser-rendering-api

analytics

next-on-pages

cloudflare-ai

build-caching-beta

hyperdrive

vectorize

ai-gateway

How do you set the "copyright year" dynamically in Pages?

Hello everyone, I am deploying a static website on Cloudflage Pages and want to dynamically set the copyright year so I don't have to update every year (2024, 2025 etc). When I deploy it shows year 1970. Locally it works fine as it's picking up the year on my machine which is correct.

Preflight requests to static Pages are returning 405

I am trying to use cloudflare pages as static html content fetched by a SPA with a separate FE domain. Since the domains are different, browsers send an OPTIONS pre-flight request for each resource. CF Pages currently returns a 405 status code to any OPTIONS request. Is there a way to handle these pre-flight requests without a worker or CF function since that would get very expensive quickly. I've also tried to bypass these preflight requests to a separate domain with a rewrite rule, but tha...

Creating Cloudflare pages for React

I normally create Cloudflare pages for vanilla html & css. But, we are launching a new website with React. I'm a React newbie and I'm a stuck on creating the pages to to work with React. I've read the Cloudflare documentation, but I'm not sure where I put the commands listed on this page https://developers.cloudflare.com/pages/framework-guides/deploy-a-react-site/ Any help appreciated. #react #pages-help #pages-discussions...

Need Help with Astro + Cloudflare + Turso DB Setup

Hey everyone, I’m running into an issue with my Astro app. Locally, everything works fine, but in production on Cloudflare, I’m getting a 401 Unauthorized error when trying to insert data into the database (db.insert(Waitlist_signups)). I’m using Turso for the database as per the documentation and have added the necessary environment variables (both the DB token and URL) in Cloudflare, but still facing this issue. Has anyone encountered something similar or know what could be causing the 401 error? Thanks in advance for any help!...

Cloudflare Cache Is Stuck

Hi - our Cloudflare Cache seems to be stuck for our page https://www.remnote.com/pricing. This URL is from a cloudflare pages deployment. Whenever we load it, we're seeing an old age of 90890 seconds (25 hours). We've tried: 1. Purging our full Cloudflare cache 2. Purging cache for that specific URL...
No description

Accidentally turned on access policy; can't turn off without a credit card?

I accidentally turned on the Access Policy in my cloudflare page settings. When I try to turn it back off, it redirects me to the Cloudflare Zero Trust page, & to pick a plan I have to provide a credit card. Now my preview sites are also behind the access lock, which I can't remove. Example: https://65158e2c.ttc-bus-eta.pages.dev/ I don't have a credit card, I just want to turn it back off. Is there a way to do it?...

How to set up auth for static files

I am using SolidStart which uses Nitro I have been going down a rabbit hole of trying to figure out how I can set up an admin app or portion of the main app and have its static assets protected by JWT auth or something similar I heard of a functions/_middleware.js approach, but this was never deployed/built/recognized by wrangler or the framework Found out it is probably due to the presence of a _worker.js, which is not even a file, its a directory, which I have hardly seen any information about it being a directory I am not sure the best way to go about it. Do I somehow inject code somewhere in the _worker.js directory?...
No description

Issue with Remix App Deployment on Cloudflare Pages - 404 Error After Successful Deploy

I’m having trouble deploying a simple Remix app. I created the app by running npm run remix@latest, pushed the local repo to GitHub, and connected it to Cloudflare Pages. I set up the deployment and picked the correct repo. The deployment is successful, but when I click the link, I’m getting a 404 error instead of the page being rendered. I followed the Pages documentation and pointed to the correct build/client folder. Any ideas on what could be wrong?

What is Cloudflare using to do SSR? Bun? npm?

Like, after building my website, I use npm run start to test it locally, So, what does cloudflare use on the web? bun, npm? I am not asking about what is being used for building, what is being used to run it in production?

Where to put database_id for a D1 database?

I am trying to figure out where to put the database_id for a D1 database. I know you can put it in the [[d1_databases]] section of wrangler.toml, but this is a security risk because wrangler.toml is checked into git. So maybe it should go in .dev.vars? But then how do I reference it in wrangler.toml, or is that not necessary? If I put it in .dev.vars, how would wrangler know that it is for a D1 database? And then should it go into wrangler secrets for deployment? Thanks in advance.

Nuxt.js deployment missing CF Functions.

Hi, i just updated one of our Nuxt.js Projects to the latest release version. For whatever reason Pages no longer recognizes the functions folder. Previous Deployments with old Nuxt version didnt have this problem. The functions folder is still present in the repository and is not on the gitignore file...
No description

How can I get a A-Record for my Wordpress Website?

I created a wordpress website on Strato. I chanced the nameserver to the cloudflare nameserver and after 14 hours. my website and Domain ist registered by Cloudflare, but here is the Problem. Now that the domain and website are running via Cloudflare, I can no longer access my Wordpress website and there are no DNS settings. Starto support told me not to change the name servers, but only the A-record at Strato so that the website runs via Cloudflare. ...

How to use npm run dev?

Hello everyone. I'm currently using cloudflare to develop backend. But I can't run num run dev, So I have no choice but to deploy with the num run depoly command. If anyone knows how to run the npm run dev command, please let me know....

Ignore build step

Hi All πŸ‘‹ I have a two cloudflare pages project setup on the same github repository to seperate environments with automated deployments. - acme-production (branch main) - acme-staging (branch develop)...

How can i use modules in Pages functions

How can i use modules i already installed on Pages on the /functions dir, i'm lost help, i understant it works like Workers no?
No description

Array.prototype.toReversed() works at runtime but not build

I have an Astro project that uses toReversed() on a json import, this works fine on SSR pages but fails saying that the function is not defined during build on an SSG page.

Build Stuck

I am using Bun as my pm, and have a command called build I use to create a bundle.js file. The build command runs perfectly, but my project remians with a Building... status. How could I configure the build settings to fix this?

Do single redirect rules work on Pages Custom domains, seems they dont.

Been trying to create a redirect rule with pages custom doamins, but seems it they only work with the primary domain, i have used trace and they dont pick up the rule on custom domains. i.e. my pages domain is mycompany.com, but custom domains are docs.customerA.com with a cname to my pages domain... hence any rules for the docs.customerA.com do not work -- is this by design.

domain not working even though it says active

I'm trying to connect my domain to my project, things that I have already done: - changed my DNS records in name.com - added DNS record like in the pic - custom domain says it's active my .pages.dev works fine but the actual website doesn't...
No description

Alternatives to DOMPurify?

Both DOMPurify and isometric-dompurify don't work and show a "ReferenceError: window is not defined" error. What alternatives can I use that work with Pages?