     headers =
       'Content-Type': 'text/plain'
       'Cache-Control': 'stale-while-revalidate'
+      'Access-Control-Allow-Origin': allowCors
     if req.headers['if-modified-since']
       since = Date.parse req.headers['if-modified-since']  ## NaN if invaild
       if since and req.gridFS.uploadDate and (req.headers['if-modified-since'] == req.gridFS.uploadDate.toUTCString() or since >= req.gridFS.uploadDate.getTime())

        return res.end()
    if req.headers['range']
      statusCode = 206  # partial data
      parts = req.headers["range"].replace(/bytes=/, "").split("-")
      start = parseInt(parts[0], 10)
      end = (if parts[1] then parseInt(parts[1], 10) else req.gridFS.length - 1)
      if (start < 0) or (end >= req.gridFS.length) or (start > end) or isNaN(start) or isNaN(end)

fileRe = /^\/(\w+)$/

defaultContentType = 'application/octet-stream'

## Allow files to be embedded in other sites, e.g. Cocreate.
## Note that this still requires Coauthor authentication via cookies.
allowCors = '*'

## Mimicking vsivsi:file-collection http_access_server.coffee
WebApp.rawConnectHandlers.use '/file',
