Error 404 for vite css asset files

Vite generates css asset files in the /assets/ folder; however when the browser tries to open these files, the server responds with an HTTP 404 Error. The asset files contain dots in their name (e.g. asset.n39d3od4.css). I quickly found out that any file containing a dot in its name generates an Server Error. Is there a way to circumvent this problem (like .htaccess) without having to rename all css link tags manually?

Hi and welcome to the forum

Domain/subdomain name?

3 Likes

It’s https://prawin.gq/assets/asset.83nw2k40s.css

However strangly, now the file is working normally.

So, is there a reason why this only works sometimes?

My best guess:

3 Likes

DNS Propagation can’t be the reason. This account with it’s domain was created back in December 2018. I have also experienced a problem where the PHP ??= operator wasn’t working for a short period of time, causing blank pages. This had to do with a temporary change of PHP version change I didn’t initiate. Are these types of problems known and when are these going to be fixed?

I can’t diagnose a problem that does not exist for me. Every time I have opened the file it works. Maybe the issue was caching, I have no clue, only guesses that may or may not be correct.

4 Likes

It’s working fine from here:

image

I don’t know what kind of server error you see. But having multiple dots in a file name is no problem on our hosting.

5 Likes

A post was split to a new topic: Issues with the ssl

As you can see, on Saturday, the vite asset files caused HTTP 404 Errors (different hashes, as I tried different vite configs). But now these error are gone; so was this just a temporary bug?

And the situation on Thursday

Look at the URL being requested, its different from the one you shared with us.

prawin.gq/assets/asset.e7d69ffb.css does not exist. Make sure you have uploaded all the files.

2 Likes

Are these files generated by something (hence the hashes)? Are you sure the URLs on your pages use the correct hashes, and that all related files are uploaded?

Cloudflare and their caching may also be making things more complicated.

4 Likes

I’m using Astro js as a static site generator; i checked the files and the link tags and they did point to the correct files. I am using Cloudflare and itt’s caching features which worked normally with all files. So the problem might be with Cloudflare.

1 Like

Now, I’ve found out what the problem is. While I was uploading my dist folder generated by Astro, a user opened the HTML page, before /assets/ folder was uploaded by my FTP Client. Cloudflare cached the 404 Error (it looks like Cloudflare doens’t update it’s .css and .js files even when there is a file modification unlike .php and .html). So in order to fix that problem, I had to purge the Cache.

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.