<?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>SysAdmin Adventures &#187; Apache</title>
	<atom:link href="http://blog.tpa.me.uk/category/linux/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tpa.me.uk</link>
	<description>Tech notes from a Systems Administrator</description>
	<lastBuildDate>Mon, 31 Oct 2011 11:09:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>WordPress.com Stats Plugin :: Flash Not Loading After Update</title>
		<link>http://blog.tpa.me.uk/2010/02/23/wordpress-com-stats-plugin-flash-not-loading-after-update/</link>
		<comments>http://blog.tpa.me.uk/2010/02/23/wordpress-com-stats-plugin-flash-not-loading-after-update/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 13:59:18 +0000</pubDate>
		<dc:creator>Zordrak</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[stats]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.tpa.me.uk/?p=320</guid>
		<description><![CDATA[Have you just updated your WordPress.com Stats plugin? Does your stats page no longer show the graph? Would you like to know why? The reason is because the plugin now includes a .htaccess file (/plugins/stats/.htaccess) and the .htaccess file contains: &#60;Files *.swf&#62; Allow from All &#60;/Files&#62; By default, in a reasonably secure setup, the .htaccess [...]]]></description>
			<content:encoded><![CDATA[<p>Have you just updated your WordPress.com Stats plugin? Does your stats page no longer show the graph? Would you like to know why?</p>
<p>The reason is because the plugin now includes a .htaccess file (/plugins/stats/.htaccess) and the .htaccess file contains:</p>
<div class="codecolorer-container apache geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">Files</span> *.swf&gt;<br />
<span style="color: #00007f;">Allow</span> from <span style="color: #0000ff;">All</span><br />
&lt;/<span style="color: #000000; font-weight:bold;">Files</span>&gt;</div></div>
<p>By default, in a reasonably secure setup, the .htaccess file does not have permission to specify an Allow directive. This really shouldn&#8217;t be a problem as it should just be ignored, but it seems that for some reason, the fact that the directive is not allowed causes apache to actively deny access instead even though it would work perfectly if the .htaccess file weren&#8217;t there at all. I don&#8217;t know why, it just does.</p>
<p>One solution would be to delete the .htaccess file, but I prefer not to adjust the plugin as a simple adjustment to the apache configuration will solve the problem. Apache needs to be told to allow the .htaccess file to specify an Allow directive using the AllowOverride directive in the main configuration.</p>
<p>Those who have implemented Permalinks will already have included:</p>
<div class="codecolorer-container apache geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">AllowOverride</span> FileInfo</div></div>
<p>All you need to do is extend it to include Limit as well:</p>
<div class="codecolorer-container apache geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">AllowOverride</span> FileInfo Limit</div></div>
<p>You could achieve the same result with:</p>
<div class="codecolorer-container apache geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #00007f;">AllowOverride</span> <span style="color: #0000ff;">All</span></div></div>
<p>I heavily recommend against it as it has the potential to be a security threat. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tpa.me.uk/2010/02/23/wordpress-com-stats-plugin-flash-not-loading-after-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AWStats</title>
		<link>http://blog.tpa.me.uk/2009/08/31/79/</link>
		<comments>http://blog.tpa.me.uk/2009/08/31/79/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 18:48:44 +0000</pubDate>
		<dc:creator>Zordrak</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[statistics]]></category>

		<guid isPermaLink="false">http://blog.tpa.me.uk/?p=79</guid>
		<description><![CDATA[If you are running an apache web server and serving content to the public, you are either running AWStats, or you are an idiot. I used to be an idiot. Now I am running AWStats.]]></description>
			<content:encoded><![CDATA[<p>If you are running an apache web server and serving content to the public, you are either running AWStats, or you are an idiot.</p>
<p>I used to be an idiot. Now I am running AWStats.</p>
<div id="attachment_83" class="wp-caption aligncenter" style="width: 248px"><a href="http://awstats.sourceforge.net" title="AWStats Logo" onclick="pageTracker._trackPageview('/outgoing/awstats.sourceforge.net?referer=');"><img src="http://blog.tpa.me.uk/wp-content/uploads/2009/08/awstats_logo5.png" alt="Free real-time logfile analyzer to get advanced statistics (GNU GPL)." title="AWStats Logo" width="238" height="54" class="size-full wp-image-83" /></a><p class="wp-caption-text">Free real-time logfile analyzer to get advanced statistics (GNU GPL).</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.tpa.me.uk/2009/08/31/79/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Forcing browsers to &#8220;open with..&#8221; or &#8220;save&#8221; attachments</title>
		<link>http://blog.tpa.me.uk/2009/08/30/forcing-browsers-to-open-with-or-save-attachments/</link>
		<comments>http://blog.tpa.me.uk/2009/08/30/forcing-browsers-to-open-with-or-save-attachments/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 20:22:38 +0000</pubDate>
		<dc:creator>Zordrak</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[content]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[force]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[mime]]></category>
		<category><![CDATA[open]]></category>

		<guid isPermaLink="false">http://blog.tpa.me.uk/?p=33</guid>
		<description><![CDATA[There are times when you want to force web-browsers to handle a file differently to its default action. Specifically for me, I wanted browsers to not open certain text files themselves, but instead pass them to a text editor. Doing this is quite easy, but how is not well-known. Obviously the immediate choice is to [...]]]></description>
			<content:encoded><![CDATA[<p>There are times when you want to force web-browsers to handle a file differently to its default action. Specifically for me, I wanted browsers to not open certain text files themselves, but instead pass them to a text editor. Doing this is quite easy, but how is not well-known.</p>
<p>Obviously the immediate choice is to change the mime-type handling of the browser which is possible in Firefox, although not easily &#8211; I&#8217;m not sure if it&#8217;s possible in IE &#8211; but this has to be done manually for every browser. For Firefox you need to either get an extension for modifying the handlers, or you need to find a text file that has been forced into using the Open/Save dialogue (as per solution below) and then use the &#8220;Always perform this action&#8221; checkbox.</p>
<p>I decided to look at how the file is sent from the server as, often, when a txt file is passed from a CGI script, you get the Open/Save dialogue option. Although there are many different ways you can do it, the canonical way is for the server to pass a &#8220;Content-Disposition: attachment&#8221; response header to the browser which will stop it disposing of the file by opening within the browser regardless of the mime-type it sniffs from the file. As ALWAYS, Internet Explorer does not follow this rule and will often ignore the content-disposition header and act based on the mime-type it sniffs from the file regardless and so, to deal with IE you also need to force the mime-type to application/octet-stream.</p>
<p>This needs to be done in the Apache config, however the best way to do it is with .htaccess as it gives you directory-level control on the files you are affecting. Because it is being done with a regular expression being passed to the FilesMatch directive, you can choose to specify a particular file extension to affect as I have below, or you can specify a particular file, or anything else you can normally do with a regexp.</p>
<p>The following is the correct directive for a .htaccess file if you want to match any file with a .txt file extension, matching upper-case, lower-case or a mixture of cases. When matching the regexp, the mime-type is forced to &#8220;application/octet-stream&#8221; and the &#8220;Content-Disposition: attachment&#8221; header is passed.</p>
<div class="codecolorer-container apache geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">FilesMatch</span> <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>(?i:txt)$&quot;</span>&gt;<br />
&nbsp; <span style="color: #00007f;">ForceType</span> application/octet-stream<br />
&nbsp; <span style="color: #00007f;">Header</span> set Content-Disposition attachment<br />
&lt;/<span style="color: #000000; font-weight:bold;">FilesMatch</span>&gt;</div></div>
<p>You&#8217;re welcome <img src='http://blog.tpa.me.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tpa.me.uk/2009/08/30/forcing-browsers-to-open-with-or-save-attachments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

