Whether a particular file is static or dynamic on the server depends on your handler configuration - many asp.net apps (among them asp.net atlas, I believe) generate responses to .js files dynamically (.js is mapped to aspnet_isapi.dll) - so only dynamic compression
can be applied to .js files in those cases.
Anil Ruia
Software Design Engineer
IIS Core Server
This line generates an http request for a .js file.
Here is the request and answer.
Request:
GET /Utils/Utils.js HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: */*
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/learnJS/learnJS.html
Response from IIS 7.0
HTTP/1.x 200 OK
Content-Type: application/x-javascript
Content-Encoding: gzip
Last-Modified: Sat, 03 Feb 2007 21:27:08 GMT
Accept-Ranges: bytes
Etag: "7982afda47c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Thu, 08 Feb 2007 06:33:09 GMT
Content-Length: 422
If i was requesting the .js file through a .aspx script i could undestand, but here i'm just requesting a static file which doesn't change. That's why i can't undestand why IIS7.0 is serving it as a dynamic type.
Compression should be active since i'm receiving a gzip encoded response, but to make it happen as i said in my last post, i had to add that line under dynamic types compression.
Maybe i'm missing something in undestanding how IIS7.0 really works.
.js does seem to be mapped to staticfile - maybe, static compression is just busted on your machine - can you enable "failed request tracing" (just do it for all 200 responses) and collect a freb log and attach it to the thread?
Anil Ruia
Software Design Engineer
IIS Core Server
.js does seem to be mapped to staticfile - maybe, static compression is just busted on your machine - can you enable "failed request tracing" (just do it for all 200 responses) and collect a freb log and attach it to the thread?
Sorry for this late response, i'm delayed cause exams.
Can you dump your httpCompression and urlCompression sections?
\Windows\system32\inetsrv\appcmd.exe list config -section:httpCompression
\Windows\system32\inetsrv\appcmd.exe list config -section:urlCompression
Also, can you check the ACL for whatever directory the compression cache points to (according to httpCompression section) - there would also be an event log entry regarding that.
Anil Ruia
Software Design Engineer
IIS Core Server
Infact, the html file compressed is inside C:\inetpub\temp\IIS Temporary Compressed Files\DefaultAppPool\$^_gzip_F^\BACKUP\WEBSITES\LEARNINGWEB\LEARNJS directory.
I cannot find Utils.js and Debug.js compressed ones.
For *.js files, only dynamic compression actually works after the static one fails.
Maybe conflicting rules, maybe i wasn't restarting correctly IIS, anyway i'm not assuming IIS is behaving in a random way, surely there are specific reasons to what is happening.
In all my tries, the browser cache was disabled in order to avoid 304 not modified header only responses.
These are all gets/responses dialogue:
http://www.mypublicip.com/learnJS/learnJS.html
GET /learnJS/learnJS.html HTTP/1.1
Host: www.mypublicip.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Content-Type: text/html
Content-Encoding: gzip
Last-Modified: Sat, 17 Feb 2007 19:46:18 GMT
Accept-Ranges: bytes
Etag: "0217f4acc52c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Sun, 18 Feb 2007 08:34:58 GMT
Content-Length: 750
http://www.mypublicip.com/js/Utils.js
GET /js/Utils.js HTTP/1.1
Host: www.mypublicip.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: */*
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.mypublicip.com/learnJS/learnJS.html
HTTP/1.x 200 OK
Content-Type: application/x-javascript
Content-Encoding: gzip
Last-Modified: Fri, 16 Feb 2007 17:57:24 GMT
Accept-Ranges: bytes
Etag: "01a84e9f351c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Sun, 18 Feb 2007 08:34:58 GMT
Content-Length: 245
----------------------------------------------------------
http://www.mypublicip.com/js/Debug.js
GET /js/Debug.js HTTP/1.1
Host: www.mypublicip.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: */*
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.mypublicip.com/learnJS/learnJS.html
HTTP/1.x 200 OK
Content-Type: application/x-javascript
Content-Encoding: gzip
Last-Modified: Sat, 17 Feb 2007 17:43:19 GMT
Accept-Ranges: bytes
Etag: "8015451cbb52c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Sun, 18 Feb 2007 08:34:58 GMT
Content-Length: 725
Now static types are gzipped with static compressor.
.aspx pages are gzipped too by dynamic compressor thanks to the <add mimeType="text/*" enabled="true" /> line.
Maybe i was missing how those "add rules" really behave.
Marzullo
15 Posts
httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 04, 2007 06:26 AM|LINK
Why .js files are considered dynamic content?
I tought a js. file was a static one.
I'm saying that becouse in order to receive gzipped encoded .js files in firefox i have to add this line under the dynamicTypes tag.:
<add mimeType="application/x-javascript" enabled="true" />
Why? i'm confused, .js is static.
This is my actual httpcompression config:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
</httpCompression>
And..., if i delete <add mimeType="application/x-javascript" enabled="true" /> under dynamicTypes, .js isn't sent to my browser gzipped anymore.
This is my urlCompression setting:
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
Thank you.
anilr
2343 Posts
Microsoft
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 05, 2007 03:51 PM|LINK
Software Design Engineer
IIS Core Server
Marzullo
15 Posts
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 08, 2007 05:36 AM|LINK
<script src="../Utils/Utils.js" charset="UTF-8" type="text/javascript"></script>
This line generates an http request for a .js file.
Here is the request and answer.
Request:
GET /Utils/Utils.js HTTP/1.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: */*
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost/learnJS/learnJS.html
Response from IIS 7.0
HTTP/1.x 200 OK
Content-Type: application/x-javascript
Content-Encoding: gzip
Last-Modified: Sat, 03 Feb 2007 21:27:08 GMT
Accept-Ranges: bytes
Etag: "7982afda47c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Thu, 08 Feb 2007 06:33:09 GMT
Content-Length: 422
If i was requesting the .js file through a .aspx script i could undestand, but here i'm just requesting a static file which doesn't change. That's why i can't undestand why IIS7.0 is serving it as a dynamic type.
Compression should be active since i'm receiving a gzip encoded response, but to make it happen as i said in my last post, i had to add that line under dynamic types compression.
Maybe i'm missing something in undestanding how IIS7.0 really works.
Here are my handlers.
.js shouldn't go under * rules? --> static file?
Thank you.
anilr
2343 Posts
Microsoft
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 10, 2007 02:57 PM|LINK
Software Design Engineer
IIS Core Server
Marzullo
15 Posts
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 17, 2007 08:37 AM|LINK
Sorry for this late response, i'm delayed cause exams.
IIS Diagnostics Output
IIS Trace Detail Highlights
IIS Trace Detail
And static compression fails for html too.
Look below.
IIS Diagnostics Output
IIS Trace Detail Highlights
IIS Trace Detail
Dynamic compression is successfull, static one fails. why is my static compression busted?
anilr
2343 Posts
Microsoft
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 17, 2007 02:02 PM|LINK
The relevant events are
Can you dump your httpCompression and urlCompression sections?
\Windows\system32\inetsrv\appcmd.exe list config -section:httpCompression
\Windows\system32\inetsrv\appcmd.exe list config -section:urlCompression
Also, can you check the ACL for whatever directory the compression cache points to (according to httpCompression section) - there would also be an event log entry regarding that.
Software Design Engineer
IIS Core Server
Marzullo
15 Posts
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 18, 2007 06:21 AM|LINK
Done.
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
</dynamicTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true" />
I just noticed that "C:\inetpub\temp\IIS Temporary Compressed Files" doesn't exist. -_-
I tried to manually create it, but nothing, the same as before, static compression fails.
My %SystemDrive% echo answers C:\
Marzullo
15 Posts
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 18, 2007 06:49 AM|LINK
I tried to erase the 4th child under staticTypes becouse it seems a conflicting rule.
Now html compression works:
but .js compression fails
Infact, the html file compressed is inside C:\inetpub\temp\IIS Temporary Compressed Files\DefaultAppPool\$^_gzip_F^\BACKUP\WEBSITES\LEARNINGWEB\LEARNJS directory.
I cannot find Utils.js and Debug.js compressed ones.
For *.js files, only dynamic compression actually works after the static one fails.
I'm getting confused. :-\
Marzullo
15 Posts
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 18, 2007 07:34 AM|LINK
Finally i managed to make it works with these settings:
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
</staticTypes>
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
</dynamicTypes>
</httpCompression>
Maybe conflicting rules, maybe i wasn't restarting correctly IIS, anyway i'm not assuming IIS is behaving in a random way, surely there are specific reasons to what is happening.
In all my tries, the browser cache was disabled in order to avoid 304 not modified header only responses.
These are all gets/responses dialogue:
http://www.mypublicip.com/learnJS/learnJS.html
GET /learnJS/learnJS.html HTTP/1.1
Host: www.mypublicip.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
HTTP/1.x 200 OK
Content-Type: text/html
Content-Encoding: gzip
Last-Modified: Sat, 17 Feb 2007 19:46:18 GMT
Accept-Ranges: bytes
Etag: "0217f4acc52c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Sun, 18 Feb 2007 08:34:58 GMT
Content-Length: 750
http://www.mypublicip.com/js/Utils.js
GET /js/Utils.js HTTP/1.1
Host: www.mypublicip.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: */*
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.mypublicip.com/learnJS/learnJS.html
HTTP/1.x 200 OK
Content-Type: application/x-javascript
Content-Encoding: gzip
Last-Modified: Fri, 16 Feb 2007 17:57:24 GMT
Accept-Ranges: bytes
Etag: "01a84e9f351c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Sun, 18 Feb 2007 08:34:58 GMT
Content-Length: 245
----------------------------------------------------------
http://www.mypublicip.com/js/Debug.js
GET /js/Debug.js HTTP/1.1
Host: www.mypublicip.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; it; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
Accept: */*
Accept-Language: it-it,it;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://www.mypublicip.com/learnJS/learnJS.html
HTTP/1.x 200 OK
Content-Type: application/x-javascript
Content-Encoding: gzip
Last-Modified: Sat, 17 Feb 2007 17:43:19 GMT
Accept-Ranges: bytes
Etag: "8015451cbb52c71:0"
Vary: Accept-Encoding
Server: Microsoft-IIS/7.0
X-Powered-By: ASP.NET
Date: Sun, 18 Feb 2007 08:34:58 GMT
Content-Length: 725
Now static types are gzipped with static compressor.
.aspx pages are gzipped too by dynamic compressor thanks to the <add mimeType="text/*" enabled="true" /> line.
Maybe i was missing how those "add rules" really behave.
Marzullo
15 Posts
Re: httpCompression and .js files (why .js is handled as a dynamic type from iis7?)
Feb 18, 2007 08:31 AM|LINK