Issue when setting mode from Developer to Production
-
09-03-2021 - |
Question
My Magento 2 webshop (oplader.com) is having CSS/JS issues when setting the mode to production.
It gives the following error in the console:
The resource from “https://www.oplader.com/%3Clink%20href=%22https://fonts.goog…t.css%22%3E%3Cscript%20type=%22text/javascript%22%3Erequire([” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
Some additional information:
- In developer mode, no issues are shown in the console log.
- I have refreshed the cache, run setup, deployed static-content and recompiled di.
- I have checked the presence of the .htaccess
It is also showing this in the HTML and on top of the page:
I have had it in production mode before with no issues. Does anyone know how to might occur?
Solution
After digging into it, it seemed to start with a line of code which should have added Google Fonts to the website. This was set-up in the Porto Theme Design screen in the admin panel. When disabling Google Fonts there, the issue was resolved.
I will now add Google Fonts manually outside the Theme settings.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange