Skip to content Skip to sidebar Skip to footer

Django + React The Resource Was Blocked Due To Mime Type (“text/html”) Mismatch (x-content-type-options: Nosniff)

Developing a django app with frontend react and serving the react build files with django. project structure is as everything works fine when in settings.py I have DEBUG=True Howe

Solution 1:

For anyone coming here from Google, you should probably see this question.

In summary, when Debug is off Django stops handling static files for you. Your production server should deal with this instead.

If you still want to run your server locally, you should use:

./manage.py runserver --insecure

This is obviously not secure in production, hence its name.


Solution 2:

After googling here and there, I realized that Heroku was running the script

python manage.py collectstatic

but not finding any static files for my react app because I had not committed the react build folder to git.

so adding the build folder to git and committing the changes made it work properly.


Post a Comment for "Django + React The Resource Was Blocked Due To Mime Type (“text/html”) Mismatch (x-content-type-options: Nosniff)"