Cloudflare Pages massive Loading Time
I am currently in the process of deploying my web application and have run into a performance issue after changing my hosting setup. My domain is managed through Cloudflare. The frontend is built with React and Vite and was originally deployed on GitHub Pages, where everything worked fine. I recently migrated the frontend to Cloudflare Pages. In addition, I have a backend running on a DigitalOcean server, which I secured with HTTPS, including setting up a Cloudflare Tunnel, because I need to send and upload images through the API.
Since moving to Cloudflare Pages, I have noticed that on the very first visit to the site, images load extremely slowly. Images that are hardcoded in the frontend render with a visible delay and appear progressively from top to bottom. The images themselves are not large—they are mostly in WebP format and only a few kilobytes each—so this slow rendering seems unusual. This only happens on the initial load; after that, the site behaves normally and loads fast.
On top of that, images that are fetched or sent through the backend API also appear with a short delay after the page loads. This delay is noticeable even though both the frontend and backend are now served over HTTPS. Interestingly, third-party performance tracking tools report that the site’s loading speed is fine, which makes the issue difficult to diagnose from a metrics perspective. The same setup did not show these issues when the frontend was hosted on GitHub Pages, which makes me wonder whether this behavior is expected with Cloudflare Pages or if I am missing an important optimization or configuration step.
I would appreciate any insight into whether this is normal behavior for Cloudflare Pages, whether it could be related to cold cache behavior, image delivery, Vite build settings, or the Cloudflare Tunnel setup, and what best practices exist to improve first-load performance for new users.
Since moving to Cloudflare Pages, I have noticed that on the very first visit to the site, images load extremely slowly. Images that are hardcoded in the frontend render with a visible delay and appear progressively from top to bottom. The images themselves are not large—they are mostly in WebP format and only a few kilobytes each—so this slow rendering seems unusual. This only happens on the initial load; after that, the site behaves normally and loads fast.
On top of that, images that are fetched or sent through the backend API also appear with a short delay after the page loads. This delay is noticeable even though both the frontend and backend are now served over HTTPS. Interestingly, third-party performance tracking tools report that the site’s loading speed is fine, which makes the issue difficult to diagnose from a metrics perspective. The same setup did not show these issues when the frontend was hosted on GitHub Pages, which makes me wonder whether this behavior is expected with Cloudflare Pages or if I am missing an important optimization or configuration step.
I would appreciate any insight into whether this is normal behavior for Cloudflare Pages, whether it could be related to cold cache behavior, image delivery, Vite build settings, or the Cloudflare Tunnel setup, and what best practices exist to improve first-load performance for new users.
