TL,DR;
SOLUTION:
On my host I had to disable Dynamic compression,
In addition it (my browser?) seemed to be finicky about the charset
(.jsgz wanted application/x-javascript; charset=UTF-8)
I also had to register all 5 types in the mime section - not just the two in the original web.config or I got 404.3 errors
For some reason I did not get gzip attached to my RESPONSE HEADERS so I mangled together the following, which attempts to do all these things.
<?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>
That one web.config needs dropping either in the root of the site you are hosting it on - or the main subfolder of the game you want to serve.
Whether or not you will need some or all of this I do not know.
I needed all of it.
Hope it helps someone. Massive thanks to philwinkel for his tireless efforts of assistance.
ORIG POST:
So I pored over the docs (such as they were, the ones I could find); Watched every video I could find about deployment (none actually useful); Tried web-searching; Read several, almost, related threads about web.config (the first part I posted below), Nothing actually seems to cover what I am experiencing.
I can not for the life of me figure out how to serve these files via IIS.
I think I have tried every permutation I can think of now of configurations (which isn’t admittedly many)
I get that there are some new file types. and they need mime registering. (see below)
I also observe that - through testing - unless I actually also allow the mime types of the .datagz .memgz .jsgz to be registered that they are not served. (I can find no reference to this requirement anywhere)
Here is what I have so far:
For some reason my latest build didn’t even spit out a web.config (a previous one did) - it is just a red plane and a green cube. nothing fancy.
In the web.config that was generated I have
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
<mimeMap fileExtension=".data" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
and the .htaccess file (which is not IIS friendly directly but can be imported) says
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP:Accept-encoding} gzip
RewriteRule (.*)Data(.*)\.js $1Compressed$2\.jsgz [L]
RewriteRule (.*)Data(.*)\.data $1Compressed$2\.datagz [L]
RewriteRule (.*)Data(.*)\.mem $1Compressed$2\.memgz [L]
RewriteRule (.*)Data(.*)\.unity3d $1Compressed$2\.unity3dgz [L]
AddEncoding gzip .jsgz
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .unity3dgz
which as far as I can tell is the same as 4 rewrite rules in IIS
(careful - when you import the rules directly via the IIS importer: the format will be wrong and it will be appending an extra / after the rewritten URL and before the filename - like /Compressed/fileuploader/.jsgz - so fix that by eliding the extra / from the rule.
You can jump on the actual server and run the requests locally to check the errors if you have it configured this way.
Here is a previous request for: http://kaycare.co.uk/games/WebGL/Data/fileloader.js
(requested directly)
I got the error:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Module StaticFileModule
Notification ExecuteRequestHandler
Handler StaticFile
Error Code 0x80070032
Requested URL /games/WebGL/Compressed/fileloader.jsgz
Physical Path \games\WebGL\Compressed\fileloader.jsgz
Logon Method Anonymous
Logon User Anonymous
SO TO FIX THIS I MADE THE FILE BELOW
In addition it seems like then (as I was saying before) I have to also allow the various compressed types to be served?
I made this:
Which is a rewrite of http://forums.iis.net/post/1970627.aspx
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<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>
<!-- AND MIME REGISTER THE TYPES //-->
<mimeMap fileExtension=".jsgz" mimeType="application/x-javascript" />
<mimeMap fileExtension=".datagz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".memgz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".unity3dgz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".mem" mimeType="application/octet-stream" />
<mimeMap fileExtension=".data" mimeType="application/octet-stream" />
</staticContent>
</system.webServer>
</configuration>
To handle that bit. not sure I got it right?
However when I finally put all this in place I end up with an Illegal character complaint?
(because the zipped file is NOT a script one would assume) - so it’s now “serving” but not being “serviced”
Anyone who has any knowledge I would be very appreciative.
I did try out the “Answers” section for a day first, but this was drowned out in “How do I script” noise.
I see that this answer will have great value for all MS IIS7 users in the future and as such hope you will forgive a little cross-posting. I waited a decent time.
Kind regards,
Much confused.