omnitechie
CDCloudflare Developers
•Created by omnitechie on 8/27/2024 in #general-help
Issue with incorrect MIME type/404
I have a simple script on my Astro site located at ‘example.com/scripts/contactmodal.js’
This script toggles a contact popup with contact information.
It works fine locally, but does not work when pushed to Cloudflare pages. It WAS working as of a week or two ago (not sure when it stopped), and now I am getting errors saying the MIME type does not match, OR 404 errors, OR both at the same time (depending on what I am changing to test).
My site is extremely simple, so I am a bit baffled. It only has like 20 pages.
All paths are correct (I have checked like 50 times and so has ChatGPT), and I do not have any caching rules, page rules, or HTSTS enabled. I have tried purging my cache.
This seems to be a somewhat common sporadic bug over on the Cloudflare community support forum.
I’ve tried manually setting my content-type to application/javascript using page rules, or ‘_headers’. That is successfully st changing the MIME type and getting rid of the MIME error, and I even get a 200 status code, but the script does not execute. I have infinity-checked that this is not user related error. The script WAS executing perfectly fine before. I know the issue is not with the script, as it works fine locally.
So I am stumped. The paths are clearly all fine if it works locally, as is the script. And setting the MIME type manually does not get it to execute correctly, but does remove the errors.
The only other thing I see is that Firefox throws an error in the network panel saying “NS_ERROR_CORRUPTED_CONTENT”.
I have no idea what that means even after researching it for a bit.
Can anyone help?
Happy to provide as much information as necessary.
3 replies