Netlify not serving static assets, but github pages and build preview will

Hello beloved community,

I’m a little confused as to why Netlify won’t serve my static assets, now normally to debug this issue I would build and preview my app but this works… Whats more confusing is that Github pages also deploys my app no problem, so I’m a little lost as to why Netlify won’t do the same.

You can find the deployed Netlify app at harry-whorlow.dev, the working app at Projekt Neu | Harry Whorlow and the repo at GitHub - harry-whorlow/portfolio.

The only thing that has changed between the two is the url but it serves the html so something is working.

Furthermore, the subdomain www.harry-whorlow.dev won’t redirect to the apex domain, so I feel like I’ve missed something, and my scouring of the forums so far has produced no results.

Any advice is appreciated in advance, so thanks… and I hope you’ve had a great start to the new year!

lots of love,
The Angry Englishmen

heres the DNS records from Squarespace

@TheAngryEnglishman This is simply due to the paths, specifically what references your project is building into the html and which folder is being deployed on Netlify.

On Github you’re deploying to:
https://harry-whorlow.github.io/portfolio/

On Netlify you’re deploying to:
https://harry-whorlow.dev

The file references in your index.html assume that the project is hosted in a directory of /portfolio/

However you almost certainly have your Publish directory set to portfolio, such that the files within it aren’t deployed to /portfolio/ but to /.

As proven by those files being accessible on Netlify here:
/_astro/favicon.5cf9e28a_KNe2p.svg
/_astro/hoisted.5dad9063.css
/_astro/index.c91f7fb5.css
/_astro/hoisted.fa30b9ad.js

I’ve never used Astro but can see there is a config that specifies a base directory and site url:

As it seems you want to serve from the root on Netlify you would adjust the base to /

2 Likes

Nathan you are an absolute gem!

Thanks, that absolutely went right over my head, but once you pointed it out it was obvious. Thank you I can’t express my gratitude enough!

on a side note:
I went with changing my Netlify publishing source to “/portfolio/” in the end as making it “/” breaks Github Pages in the same way the Netlify deploy was. Kinda obscure case, as I wanted both to be live.

1 Like