bpwalters
CDCloudflare Developers
•Created by bpwalters on 8/1/2023 in #pages-help
Trouble w/ relative images - Astro site on Pages
Hey all,
I have been messing around with deploying my blog to Cloudflare Pages and the experience has been awesome! Except I'm having issues with relatively-referenced images like my favicon and a header PNG not loading. This is happening only on the Cloudflare Pages instance of the site. All other remote images, i.e. ones from my CDN, are working just fine.
These resources are referenced relatively, i.e.
/myfavicon.svg
or /header-image.png
and are placed in my Astro public
folder so they're straight copied when the site is built.
To troubleshoot, I've tried deploying the site to S3, running it via npm run preview
with Astro locally, and even running it on my DigitalOcean Droplet. In every case but Pages, I'm able to see the icon/image. In addition, my site was previously built with Gatsby, and when I deployed it to Pages I had no issues - the images loaded just fine!
Has anyone else had issues with Astro + Cloudflare Pages like this? Seems like Pages is the only variable that could be affecting things here.4 replies