luminus-framework / luminus-framework/luminus-template

Content-Type is not a script MIME type

Open
#580 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
648
Forks
143
PR merge metrics
No merged PRs in 30d

Description

Hi! When I try to serve some generated javascript file from my server in the Luminus generated project **and** run it from the repl with `(start)` I receive the following error from the client.
`Failed to load resource: the server responded with a status of 404 (Not Found)
`
`Refused to execute http://localhost:3000/js/app.js as script because "X-Content-Type-Options: nosniff" was given and its Content-Type is not a script MIME type.`

and also in this case the Content-Type header of the response for the `app.js` file is indeed not `application/javascript` but `text/html`, wrong.

I have realized this does not happen when the app run from terminal with `lein run`. Everything is working and also in this case the Content-Type header of the response for the `app.js` file is not `application/javascript` but `text/javascript `, better.

The generated files are in place with correct name with `.js` extension and javascript content, configuration is set to have `project.clj` `resource-paths` include the generated javascript file dirs.

Is this an issue or an expected behavior?

It would be strange to not have the repl when working with class alongside the server.

Contributor guide

No contributing guide indexed for this repository

Research direction

Compare the generated project behavior when started from the REPL with `(start)` versus `lein run`, using the `project.clj` resource-paths and generated `app.js` as the starting points. Trace why the REPL path returns a 404 and `text/html` while the terminal path serves JavaScript, then verify that both paths return the generated file with a script MIME type.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.