Failed to load module script:

When running my web project in caddy I get the following error in the browser.
Though I am posting one instance, there are a number of javascript files that give the same error.

“Expected a JavaScript module script but the server responded with a MIME type of “text/plain”. Strict MIME type checking is enforced for module scripts per HTML spec.”

1. Output of caddy version:


2. How I run Caddy:

caddy file-server

a. System environment:

Windows 10

I am not 100% sure if I “MUST” have a config file and how that should be configured not to have this particular issue.

A point in the right direction would be appreciated

That should work; usually this means that the MIME type couldn’t be detected because your system’s MIME types database is incomplete or missing. I think on Windows, these are extracted from the Registry.


Thanks for the hint Matt.
I checked the reg and found that the Computer\HKEY_CLASSES_ROOT\.js was not set to “text/javascript”.
Changed that and now it works fine.

Thanks again for your quick response, much apprecited.

1 Like

Excellent. Thanks for following up!

This topic was automatically closed after 30 days. New replies are no longer allowed.