Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by NenoSun · Sep 27, 2021 at 10:21 AM · webgl

Unity WebGL file loading blocked due to MIME type mismatch,Unity WebGL file blocked due to MIME mismatch.

I am building a WebGL game with the following setting:

  • Gzip compression

  • Optimize for speed

  • No decompression fallback

  • No data caching.


But I keep getting this error from the Chrome Javascript console:

The resource from “.../Build/WEBBUILD.framework.js.gz” was blocked due to MIME type (“application/x-gzip”) mismatch (X-Content-Type-Options: nosniff).


Here is my .htaccess configuration: (from the Unity manual here)

IfModule mod_mime.c
RemoveType .gz
AddEncoding gzip .gz
AddType application/octet-stream .data.gz
AddType application/wasm .wasm.gz
AddType application/javascript .js.gz AddType application/octet-stream .symbols.json.gz


I have been trying to solve this for hours but still have no clue. Help, please.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by aziz302 · Mar 17 at 02:49 PM

@NenoSun ! Hi I'm facing error like that your facing how to solve this error ? will you help me to sort out t his error? this is my Gmail : bsse386@gmail.com I'm waiting for your response

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by exafred · May 07 at 10:18 PM

Not sure if it'll apply to a build that's not using compression fallback, but I was getting the same error as you - only thing I found that seemed to do anything was adding ForceType application/javascript to the .js.gz files (courtsey of opertoonist).

Here's a copy of my working .htaccess file, in case it helps:


 #enable cached data to be read
 Header set Content-Security-Policy "worker-src 'self' blob:; script-src 'self' blob:;"

<IfModule mod_mime.c>

 # compression disabled?
 AddType application/wasm .wasm
 AddOutputFilterByType DEFLATE application/wasm

 # support for compressionfallback option
 AddEncoding gzip .unityweb

 # Gzip support
 <Files *.js.gz>
     AddType application/javascript .gz
     AddEncoding gzip .gz
     ForceType application/javascript
 </Files>
 <Files *.wasm.gz>
     AddType "application/wasm" .gz
     AddEncoding gzip .gz
 </Files>

 <Files *.data.gz>
     AddType "application/octet-stream" .gz
     AddEncoding gzip .gz
 </Files>

 # brotli support
 <Files *.js.br>
     AddType "text/javascript" .br
     AddEncoding br .br
 </Files>

 <Files *.wasm.br>
     AddType "application/wasm" .br
     AddEncoding br .br
 </Files>

 <Files *.data.br>
     AddType "application/octet-stream" .br
     AddEncoding br .br
 </Files>

</IfModule>


Build Publishing Settings used were: https://i.imgur.com/NX16MKm.png

  • compression format: gzip

  • files as hashes: no

  • data caching: yes

  • debug symbols: no

  • decompression fallback: yes

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

173 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

WebGL LoadScene or UnloadScene caused memory access out of bounds 1 Answer

Unity 2020.1 sendMessage no longer works from browers JS 1 Answer

How to make a laser pointer with WebXR 0 Answers

Leap Motion Game WebGL Error about Emscripten's Linking 0 Answers

When building on WebGL there is an error, 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges