You are viewing an old revision of this post, from January 3, 2020 @ 11:39:08. See below for differences between this version and the current revision.

Magento 2 – The resource from pub/ directory was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)

When you deploy the source code to the live server, you may see the issue

The resource from pub/ directory was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)...

You can solve it by the following ways

  1. Remove all files from var/ folder by using this command rm -rf var/*
  2. Check for .htaccess in pub/static. If not exists, take a file from a fresh setup.
  3. Run the following commands php bin/magento setup:static-content:deploy -f php bin/magento indexer:reindex php bin/magento cache:clean

Hope it helps you solve the problem 🙂

Revisions

  • January 3, 2020 @ 11:42:06 [Current Revision] by Sharing Solution
  • January 3, 2020 @ 11:40:46 by Sharing Solution
  • January 3, 2020 @ 11:39:08 by Sharing Solution

Revision Differences

January 3, 2020 @ 11:39:08Current Revision
Title
Deleted: Magento 2 - Pub/media css was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff Added: Magento 2 - The resource from pub/ directory was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)
Content
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p>When you deploy the source code to the live server, you may see the issue</p>Unchanged: <p>When you deploy the source code to the live server, you may see the issue</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Deleted: <p><code>Pub/media CSS was blocked due to MIME type (“text/html”) mismatch...</code></p> Added: <p>The resource from pub/ directory was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff)...</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p>You can solve it by the following ways</p>Unchanged: <p>You can solve it by the following ways</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:list {"ordered":true} -->Unchanged: <!-- wp:list {"ordered":true} -->
Unchanged: <ol><li>Remove all files from <code>var/</code> folder by using this command <strong>rm -rf var/*</strong> </li><li>Check for .htaccess in pub/static. If not exists, take a file from a fresh setup.</li><li>Run the following commands <code>php bin/magento setup:static- content:deploy -f php bin/magento indexer:reindex php bin/magento cache:clean</ code></li></ol>Unchanged: <ol><li>Remove all files from <code>var/</code> folder by using this command <strong>rm -rf var/*</strong> </li><li>Check for .htaccess in pub/static. If not exists, take a file from a fresh setup.</li><li>Run the following commands <code>php bin/magento setup:static- content:deploy -f php bin/magento indexer:reindex php bin/magento cache:clean</ code></li></ol>
Unchanged: <!-- /wp:list -->Unchanged: <!-- /wp:list -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p>Hope it helps you solve the problem :)</p>Unchanged: <p>Hope it helps you solve the problem :)</p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->
Unchanged: <!-- wp:paragraph -->Unchanged: <!-- wp:paragraph -->
Unchanged: <p></p>Unchanged: <p></p>
Unchanged: <!-- /wp:paragraph -->Unchanged: <!-- /wp:paragraph -->

Note: Spaces may be added to comparison text to allow better line wrapping.

No comments yet.

Leave a Reply