2

I'm trying to deliver to the browser the Compressed & Gzipped version of my javascript files using coldfusion.

I've tried to add the following to the web.config but still not showing GZIP (using Fiddler)

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll"/>
    <dynamicTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
    </dynamicTypes>
    <staticTypes>
      <add mimeType="text/*" enabled="true"/>
      <add mimeType="message/*" enabled="true"/>
      <add mimeType="application/javascript" enabled="true"/>
      <add mimeType="*/*" enabled="false"/>
    </staticTypes>
  </httpCompression>
  <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
3
  • I am not sure what is wrong... The browser should un-zip the file so that it can process it. If you look at the transport size in firebug is it smaller than the file size? Also are you serving the js file as a cfm file or purely a js file? Commented May 26, 2011 at 15:34
  • purely as a js file using zbugs.com to compress and gzip Commented May 26, 2011 at 15:41
  • Why is this tagged Coldfusion? Commented May 26, 2011 at 21:22

6 Answers 6

3

I solved my problem by installing dynamic compression under IIS Roles Services and now it works like a charm.

Sign up to request clarification or add additional context in comments.

1 Comment

I can't believe that JS compression was working, but CSS wasn't. And IIS didn't give me any error or warning! Your answer helped, thanks!
0

With compression on in IIS there is no need to pre-compress the .js files. The server will manage compressing, checking for browser support and sending the compressed file when it is supported without you doing any work on your end.

You just need to put the js file on the server and you should be good to go. Just use the normal file name in the src for the script tag and the server will manage all of the rest of it. Since it is not a ColdFusion file the ColdFusion server doesn't ever touch it.

4 Comments

But then why I get in YSlow (firebug plugin) the message "There are x plain text components that should be sent compressed with gzip"
Because if I understand right Compression and gzip are different layer of compression...So IIS take care of compression but I assume that Coldfusion (in my case) would take care of delivering the gzip files
Compression from IIS should be gzip, or a format that the browser sends in its accepts header.
0

Isn't the browser just uncompressing it, like it should, and your seeing the the end result. You could also use cfhttp to hit the same url, and see what it returns. With that, you can easily control and see what is compressed or uncompresed.

Comments

0

Only use the compression option in IIS, and directly link to the JS / CSS files, don't serve them via ColdFusion.

The content in your browser window has been minified, not compressed.

Browsers are aware of compressed content; the browser will tell the server what formats (if any) that they can handle. The compressed js file is automatically decompressed by the browser before you see it. This is why the content is see is plain text.

As for YSlow, make sure it is not complaining about uncompressed CSS files.

Comments

0

It looks like you've specified that the MIME type "application/x-javascript" should be compressed by IIS. However, you are returning the MIME type "application/javascript" from ColdFusion.

1 Comment

I've remove the CF code since IIS should be able to handle it without CF
0

for css compression maybe you guys should try this attribute;

<add mimeType="text/css" enabled="true"/>

and its the entire code(leverage browser caching includes);

<system.webServer>
<httpCompression directory="C:\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="C:\Windows\System32\inetsrv\gzip.dll"/>
<dynamicTypes>
  <add mimeType="text/*" enabled="true"/>
  <add mimeType="message/*" enabled="true"/>
  <add mimeType="application/javascript" enabled="true"/>
  <add mimeType="*/*" enabled="false"/>
  <add mimeType="text/css" enabled="true"/>
</dynamicTypes>
<staticTypes>
  <add mimeType="text/*" enabled="true"/>
  <add mimeType="message/*" enabled="true"/>
  <add mimeType="application/javascript" enabled="true"/>

  <add mimeType="*/*" enabled="false"/>
  </staticTypes>
</httpCompression>
<urlCompression doStaticCompression="true" doDynamicCompression="true"/>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00"/>
</staticContent>
</system.webServer>

1 Comment

Doesn't <add mimeType="text/*" enabled="true"/> already cover all text MIME types, including text/css?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.