<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>shapeshifter.se &#187; Apache</title>
	<atom:link href="http://www.shapeshifter.se/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shapeshifter.se</link>
	<description>Mostly miscellaneous technical mumbo-jumbo.</description>
	<lastBuildDate>Sat, 12 Dec 2009 12:00:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pre-compressed JavaScript files</title>
		<link>http://www.shapeshifter.se/2009/11/08/pre-compressed-javascript-files/</link>
		<comments>http://www.shapeshifter.se/2009/11/08/pre-compressed-javascript-files/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 11:54:54 +0000</pubDate>
		<dc:creator>fli</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[thttpd]]></category>

		<guid isPermaLink="false">http://www.shapeshifter.se/?p=671</guid>
		<description><![CDATA[You can save bandwidth by pre-compressing your JavaScript files with gzip without relying on dynamic compression such as mod_deflate.  To to this properly and having it working across all browsers you&#8217;ll need to modify your webserver to return the correct mime type and encoding for the file.
Most browsers are quite liberal in what they accept, [...]]]></description>
			<content:encoded><![CDATA[<p>You can save bandwidth by pre-compressing your JavaScript files with gzip without relying on dynamic compression such as mod_deflate.  To to this properly and having it working across all browsers you&#8217;ll need to modify your webserver to return the correct mime type and encoding for the file.</p>
<p>Most browsers are quite liberal in what they accept, except for Safari/Konqueror. For some reason it doesn&#8217;t like it if a JavaScript file ends in .gz, it ignores the content-encoding and attempts to read the compressed data as JavaScript. The key to make it work is to create a new extension, for example .jgz and set the Content-Encoding for this extension to gzip AND to set the mime type of .js to text/javascript, not text/plain or application/x-javascript.</p>
<p>To recap, call the file script.js.jgz and make sure your webserver delivers it with the following options</p>
<blockquote><pre>
Content-Encoding: gzip
Content-Type: text/javascript</pre>
</blockquote>
<p>Just include the file as usual</p>
<blockquote><pre>
&lt;script type="text/javascript" src="script.js.jgz"&gt;&lt;/script&gt;
</pre>
</blockquote>
<p>This has been tested with the following browsers</p>
<ul>
<li>Firefox 3.0/3.5</li>
<li>Opera 10</li>
<li>Internet Explorer 7</li>
<li>Konqueror (webkit based, behaves like Safari)</li>
<li>Google Chrome 3</li>
<li>Epiphany</li>
</ul>
<h3>Apache</h3>
<p>Put the following in a .htaccess file</p>
<blockquote><pre>
AddType text/javascript .js
AddEncoding gzip .jsz</pre>
</blockquote>
<h3>thttpd</h3>
<p>Add jsz gzip to mime_encodings.txt and change the type for js in mime_types.txt to js text/javascript.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shapeshifter.se/2009/11/08/pre-compressed-javascript-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
