Month: August 2014

Javascript development Cache headers in Apache

During development of a javascript webapp I found that the updated javascript was not picked up by my webbrowser. Even using ctrl+F5 would not always work to refresh the files. In order to make development easier I added the following cache headers to the Apache VirtualDirectory configuration in order to make the browser always fetch the latest version of the file from my development server.

<FilesMatch "\.(html|htm|js|css)$">
    FileETag None
    <ifModule mod_headers.c>
        Header unset ETag
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
    </ifModule>
</FilesMatch>

Leave a Comment

Find the largest files in subdirectories

I find myself regularly with limited diskspace, and unsure which files to remove. Normally the largest files
I do not use anymore are the best candidate. When using Linux I use the command find:

find . -type f -print0 | xargs -0 du | sort -n | tail -10 | cut -f2 | xargs -I{} du -sh {}

This command searches for the largest files. In order to find the largest redirectories, replace the -type f with -type d.

Leave a Comment