Set Expires and Cache-Control headers for .gz files

Currently regular files have caching headers set, but that doesn't work for .gz files. This pull request fixes that by stripping .gz extension when testing for a digest hash presence.