 
 module.exports.middleware = (req, res, next) =>
   
-  @gzip = req.headers['accept-encoding'].toLowerCase().indexOf('gzip') isnt -1
+  if req.headers?
+    @gzip = req.headers['accept-encoding'].toLowerCase().indexOf('gzip') isnt -1
   
   return unless @mode is 'development'
   

  
  if @mode is 'production'
    src = (@cdnUrl ? @_assetsDir) + '/' + pkg + '.css'
    src += '.cgz' if @acceptsGzip
    return "<link href='#{src}' rel='stylesheet' type='text/css'>"
  
  output = ''

  
  if @mode is 'production'
    src = (@cdnUrl ? @_assetsDir) + '/' + pkg + '.js'
    src += '.jgz' if @gzip
    return "<script src='#{src}' type='text/javascript'></script>"
  
  output = ''
