#Error with MIME, I've recently setup a rule to set .js files to be treated as .js files.

53 messages · Page 1 of 1 (latest)

sturdy fable
#

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.

dark gale
# sturdy fable

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

Learn about comparison, logical operators, and grouping symbols in Cloudflare's Rules language. Understand precedence and how to structure expressions.

dark gale
sturdy fable
#

i went off a template

#

and forgot to update it

#

XD

dark gale
#

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

sturdy fable
sturdy fable
#

because in my github repo

dark gale
#

Depends on your origin/web server setup

#

Are you using Github Pages, Cloudflare Pages, Workers Static assets, or something else?

sturdy fable
#

i'm gonna assume that's why.

dark gale
#

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

dark gale
sturdy fable
#

if it does exist

dark gale
#

you're not fetching it from that directory

#

you're trying to load it from https://flyier.xyz/auth/login.js

#

missing /callback/

sturdy fable
#

so thats why

dark gale
#

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

sturdy fable
#

one for the homepage

#

styles.css

#

and one for the callback

dark gale
#

auth-callback.css?

sturdy fable
#

yeah

dark gale
#

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>

sturdy fable
dark gale
#

yes

sturdy fable
#

perfect tysm!

#

so it wasn't with MIME after all...

dark gale
#

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

sturdy fable
#

pushing to origin rn ill keep you posted

sturdy fable
#

nvm

#

you said it beautifully

#

XD

spark robinBOT
sturdy fable
#

fr man tho @dark gale tysm

#

i'm completely new to this