If Apache2 won’t serve your JavaScript file try…

I had an issue with Apache2 improperly serving a JavaScript file which I seem to have fixed by making sure the file was terminated with a new-line character… this was really hard to diagnose and resolve! The behaviour in Firefox was that the file just didn’t finish to download, whereas the Apache2 logs indicated a 200 result… I think it may have had something to do with automatic compression, which is a dark art that I do not understand (mumbles something about mod deflate…).

PHP file_get_contents with HTTP Basic Auth

Today I needed to figure out how to read some data from a URL that required HTTP Basic Auth. The solution was pretty simple, use file_get_contents and pass in a configured stream context. I found the following code on the stream_context_create documentation:

$cred = sprintf( 'Authorization: Basic %s',
  base64_encode( 'username:password' )
$opts = array(
  'http' => array(
    'method' => 'GET',
    'header' => $cred
$ctx = stream_context_create( $opts );
$data = file_get_contents( $url, false, $ctx );


Fixing mailman can’t discard/defer message via web config

I had a notice from Mailman for one of my lists that there was a message that required administrative attention (i.e. it was spam). The mailman web-interface provides a facility for treating email, however when I went to discard the message it wouldn’t go away. I tried a heap of things and it took a long time to figure out, but eventually I noticed that in the mailman web page the domain name it was using was “intranet.blackbrick.com” whereas that should have been “www.intranet.blackbrick.com”. So I did a little searching about how to configure a list’s base URL and discovered this, which fixed my issue:

/usr/lib/mailman/bin/withlist -l -r fix_url support \

Where ‘support’ above is ‘list name’.