// After enabling Content-Encoding: gzip, make sure that the appropriate MIME type is being used for the asset, i.e. the MIME
// type should be that of the uncompressed asset, and not the MIME type of the compression method that was used.
if (xhr.getResponseHeader('Content-Type').toLowerCase().indexOf('zip') != -1) {
There “xhr.getResponseHeader(‘Content-Type’)” is returning null. Try changing the if statement to
if (xhr.getResponseHeader('Content-Type') && xhr.getResponseHeader('Content-Type').toLowerCase().indexOf('zip') != -1) {