I believe it’s because of the relative path; the “../” is considered malicious. Resolve the local path first, then call res.sendfile
. You can resolve the path with path.resolve
beforehand.
var path = require('path');
res.sendFile(path.resolve('temp/index.html'));