Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
avatar image
1
Question by twobob · Dec 05, 2014 at 03:16 PM · webglsetupconfigurationbeta5

Correctly configuring IIS7 to serve gzipped content. How.

So I did a webGL build - that finished successfully.

Now I wish to post this to my server, the content works when I try to access it through my local IIS (127.0.0.1) on my build machine (not using the gzip pipe maybe?).

However the gzipped extensions I can not figure out how to serve.

this is what I did:

1) Upload to server (I was not clear if I had to actually upload the two huge .mem and .data file in /DATA, from my reading of the rewrite rules below, "No, I do not have to" since all requests for those files will be redirected to their pre-compressed cousins. (but I did anyways to be sure) EDIT: You do NOT need to upload the huge files

2) checked that the web.config was being honoured to serve out the .mem and .data stuff

3) Imported the rules into URL rewrite via the IMPORT RULES button and double checked they were sensible. They all seemed fine - 4 rules - redirecting unzipped requests to zipped equivalents.

4) Checked that the server has dynamic and static compression installed and enabled for the domain (which it does)

5) revisited the .htaccess to see what I had missed.

It's the final bit where in the .htaccess it would have been handled by:

AddEncoding gzip .jsgz AddEncoding gzip .datagz AddEncoding gzip .memgz AddEncoding gzip .unity3dgz

I /think/ it is this bit maybe where it goes wrong. Not sure how to do this is IIS?

EDIT: Complete solution below

Many thanks.

Here is what I had scrabbled together so far

Hmm... well more digging says: That the following could have been an alternate solution for one part at least? perhaps both?

  <rewrite>
      <outboundRules>
          <rule name="Rewrite JSGZ header" preCondition="IsJSGZ" stopProcessing="true">
              <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
              <action type="Rewrite" value="gzip" />
          </rule>
         <rule name="Rewrite MemGZ header" preCondition="IsMemGZ" stopProcessing="true">
              <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
              <action type="Rewrite" value="gzip" />
          </rule>
           <rule name="Rewrite DataGZ header" preCondition="IsDataGZ" stopProcessing="true">
              <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
              <action type="Rewrite" value="gzip" />
          </rule>
         <preConditions>
              <preCondition name="IsJSGZ">
                  <add input="{PATH_INFO}" pattern="\.jsgz$" />
         </preCondition>
               <preCondition name="IsMemGZ">
                  <add input="{PATH_INFO}" pattern="\.memgz$" />
              </preCondition>
         <preCondition name="IsDataGZ">
                  <add input="{PATH_INFO}" pattern="\.datagz$" />
              </preCondition>
          </preConditions>
     </outboundRules>
  </rewrite>
  <staticContent>
      <mimeMap fileExtension=".jsgz" mimeType="application/x-javascript" />
      <mimeMap fileExtension=".datagz" mimeType="application/octet-stream" />
      <mimeMap fileExtension=".memgz" mimeType="application/octet-streamt" />
  </staticContent>
 
 

I'm total guessing here. Really, are there any docs?

EDIT: found some more info

 Notification    MapRequestHandler
 Handler    StaticFile
 Error Code    0x80070002
 Requested URL    /games/WebGL/Compressed/UnityProgress/.jsgz
 Physical Path    \games\WebGL\Compressed\UnityProgress\.jsgz

Looks like the rewrite is not working as expected...

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

1 Reply

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by twobob · Dec 06, 2014 at 02:47 PM

the complete solution:

 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
 <system.webServer>
      <rewrite>
             <rules>
                 <rule name="Imported Rule 1" enabled="true" stopProcessing="true">
                     <match url="(.*)Data(.*)\.js" ignoreCase="true" />
                     <conditions logicalGrouping="MatchAll">
                         <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" ignoreCase="true" />
                     </conditions>
                     <action type="Rewrite" url="{R:1}Compressed{R:2}.jsgz" />
                 </rule>
                 <rule name="Imported Rule 2" enabled="true" stopProcessing="true">
                     <match url="(.*)Data(.*)\.data" ignoreCase="true" />
                     <action type="Rewrite" url="{R:1}Compressed{R:2}.datagz" />
                     <conditions>
                     </conditions>
                 </rule>
                 <rule name="Imported Rule 3" enabled="true" stopProcessing="true">
                     <match url="(.*)Data(.*)\.mem" ignoreCase="true" />
                     <action type="Rewrite" url="{R:1}Compressed{R:2}.memgz" />
                     <conditions>
                     </conditions>
                 </rule>
                 <rule name="Imported Rule 4" enabled="true" stopProcessing="true">
                     <match url="(.*)Data(.*)\.unity3d" ignoreCase="true" />
                     <action type="Rewrite" url="{R:1}Compressed{R:2}.unity3dgz" />
                     <conditions>
                     </conditions>
                 </rule>
             </rules>
                  <outboundRules>
         <!-- FIRST SETUP THE SWITCHES FOR THE RESPONSE ENCODING //-->
              <rule name="Rewrite JSGZ header" preCondition="IsJSGZ" stopProcessing="false">
                  <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
                  <action type="Rewrite" value="gzip" />
              </rule>
             <rule name="Rewrite MemGZ header" preCondition="IsMemGZ" stopProcessing="false">
                  <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
                  <action type="Rewrite" value="gzip" />
              </rule>
               <rule name="Rewrite DataGZ header" preCondition="IsDataGZ" stopProcessing="false">
                  <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
                  <action type="Rewrite" value="gzip" />
              </rule>
             <rule name="Rewrite Unity3DGZ header" preCondition="IsUnity3DGZ" stopProcessing="true">
                  <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
                  <action type="Rewrite" value="gzip" />
              </rule>
              <!-- AND SETUP THE MATCHES FOR THE RESPONSE ENCODING SWITCHES //-->
             <preConditions>
                  <preCondition name="IsJSGZ">
                      <add input="{PATH_INFO}" pattern="\.jsgz$" />
             </preCondition>
                  <preCondition name="IsMemGZ">
                      <add input="{PATH_INFO}" pattern="\.memgz$" />
                  </preCondition>
             <preCondition name="IsDataGZ">
                      <add input="{PATH_INFO}" pattern="\.datagz$" />
                  </preCondition>
             <preCondition name="IsUnity3DGZ">
                      <add input="{PATH_INFO}" pattern="\.unity3dgz$" />
                  </preCondition>
              </preConditions>
         </outboundRules>
         </rewrite>
         <staticContent>
             <mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
             <mimeMap fileExtension=".data" mimeType="application/octet-stream" />
             <mimeMap fileExtension=".memgz" mimeType="application/octet-stream" />
             <mimeMap fileExtension=".datagz" mimeType="application/octet-stream" />
             <mimeMap fileExtension=".unity3dgz" mimeType="application/octet-stream" />
             <mimeMap fileExtension=".jsgz" mimeType="application/x-javascript; charset=UTF-8" />
         </staticContent>
         <urlCompression doStaticCompression="true" doDynamicCompression="false" />
 </system.webServer>
 </configuration>

as outlined here http://forum.unity3d.com/threads/solved-iis-configuring-it-to-serve-out-the-new-webgl-stack-files-how.284080/

thanks. Hope it helps someone else, took me all night to work it out :P

Comment
Add comment · Show 1 · 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 twobob · Feb 18, 2015 at 02:46 PM 0
Share

The above answer is now out of date with the advent of RC2.

The folders are called Release, Development, Compressed and TemplateData

a slight amendment should cover it I think

 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
 <system.webServer>
   <rewrite>
   <rules>
                  <rule name="IgnoreProgressScript" stopProcessing="true">
                     <match url="TemplateData\/UnityProgress\.js" />
                     <action type="None" />
                 </rule>
 
   <rule name="Imported Rule 1" enabled="true" stopProcessing="true">
   <match url="(.*)Release(.*)\.js" ignoreCase="true" />
   <conditions logicalGrouping="$$anonymous$$atchAll">
   <add input="{HTTP_ACCEPT_ENCODING}" pattern="gzip" ignoreCase="true" />
   </conditions>
   <action type="Rewrite" url="{R:1}Compressed{R:2}.jsgz" />
   </rule>
   <rule name="Imported Rule 2" enabled="true" stopProcessing="true">
   <match url="(.*)Release(.*)\.data" ignoreCase="true" />
   <action type="Rewrite" url="{R:1}Compressed{R:2}.datagz" />
   <conditions>
   </conditions>
   </rule>
   <rule name="Imported Rule 3" enabled="true" stopProcessing="true">
   <match url="(.*)Release(.*)\.mem" ignoreCase="true" />
   <action type="Rewrite" url="{R:1}Compressed{R:2}.memgz" />
   <conditions>
   </conditions>
   </rule>
   <rule name="Imported Rule 4" enabled="true" stopProcessing="true">
   <match url="(.*)Release(.*)\.unity3d" ignoreCase="true" />
   <action type="Rewrite" url="{R:1}Compressed{R:2}.unity3dgz" />
   <conditions>
   </conditions>
   </rule>
 
   </rules>

For the opening rules probably

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

25 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

Related Questions

WebGL + Sqlite3 1 Answer

Controller Setup? 1 Answer

Making antivirus play nice with Unity 1 Answer

Persistent data between different games - local save for WebGL 1 Answer

How to connect to server with a WebGL Build using Unity's Multiplayer Service, Unity 1 Answer


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