Generic file serving code for gridfs files
Fix domain setting on cookie