Error with MIME, I've recently setup a rule to set .js files to be treated as .js files.
Error with MIME, I've recently setup a rule to set .js files to be treated as .js files. yet, I still get an error saying this: here's my rules.


Solution:Jump to solution
so your html should be like this:
Before:
<link rel="stylesheet" href="styles.css">
specifying just a file name makes it relative to the current dir, so it tries to load it at /auth/style.css if you're on that page
to...
28 Replies

Wildcard isn't regex, it's much simpler then that:
https://developers.cloudflare.com/ruleset-engine/rules-language/operators/#wildcard-matching
Also your expression is literally URI Full Wildcard "http request uri matches ..." doesn't make sense
URI Path Ends With is a lot simpler and better
Cloudflare Docs
Operators and grouping symbols
Learn about comparison, logical operators, and grouping symbols in Cloudflare's Rules language. Understand precedence and how to structure expressions.
OH IM STUPID
but also, what are you trying to do? https://flyier.xyz/auth/login.js legitimately does not return JS, neither does https://flyier.xyz/auth/styles.css return CSS. You can override the mime type all you want but it's not going to do anything
i went off a template
and forgot to update it
XD
You still really shouldn't need to override mime type/your origin should set it automatically if it was actually returning JS and css, which it's not
I'm not sure why it doesn't exist in the /auth/ because it exists on https://flyier.xyz in the network tab.
I guess my question is how do I make it return as css and js?
because in my github repo
Depends on your origin/web server setup
Are you using Github Pages, Cloudflare Pages, Workers Static assets, or something else?
github pages

i'm gonna assume that's why.
it's just missing those files in the deploy step yea. Not sure if you're using a framework to build but there's def no login.js there

its under the auth/callback
so it'd be at https://flyier.xyz/auth/callback/login.js
so then why isn't it running here
if it does exist
you're not fetching it from that directory
you're trying to load it from
https://flyier.xyz/auth/login.js
missing /callback/https://flyier.xyz/auth/
so thats why
and you're trying to load
https://flyier.xyz/auth/styles.css
but it's not at /auth/style.css
it's at the root https://flyier.xyz/styles.css
there's 2 seperate css files
one for the homepage
styles.css
and one for the callback
auth-callback.css?
yeah
Solution
so your html should be like this:
Before:
<link rel="stylesheet" href="styles.css">
specifying just a file name makes it relative to the current dir, so it tries to load it at /auth/style.css if you're on that page
to
<link rel="stylesheet" href="/auth/callback/auth-callback.css">
starting with / makes it all relative to the root of the site instead of the current directory
old:
<script src="login.js"></script>
new:
<script src="/auth/callback/login.js"></script>
so this: <link rel="stylesheet" href="/auth/callback/auth-callback.css">
<script src="/auth/callback/login.js"></script>?
yes
perfect tysm!
so it wasn't with MIME after all...
Because your files couldn't be found it was serving a default page (your index.html) which is of course, HTML and not CSS/JS
so the Browser was just like "hey this is attempting to load it as CSS/JS but this is clearly not right"
MIME Types are essentially file extensions in the web world, like trying to load a word doc .docx as a png by renaming it, just not going to work lol
pushing to origin rn ill keep you posted
ah
so
so I was telling it
nvm
you said it beautifully
XD
fr man tho @Chaika tysm
i'm completely new to this
so its really helpful