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'));
More Related Contents:
- Push items into mongo array via mongoose
- How to share sessions with Socket.IO 1.x and Express 4.x?
- How can I set NODE_ENV=production on Windows?
- What does body-parser do with express?
- How to include route handlers in multiple files in Express? [duplicate]
- How to redirect 404 errors to a page in ExpressJS?
- Node/Express file upload
- npm WARN package.json: No repository field
- socket.io and session?
- Order of router precedence in express.js
- How to modify the nodejs request default timeout time?
- What is the difference between res.end() and res.send()?
- Express next function, what is it really for?
- add created_at and updated_at fields to mongoose schemas
- Redirecting to previous page after authentication in node.js using passport.js
- Mongoose update without callback
- What does middleware and app.use actually mean in Expressjs?
- 502 Bad Gateway Deploying Express Generator Template on Elastic Beanstalk
- Does Express.js support sending unbuffered progressively flushed responses?
- Node + Express + Passport: req.user Undefined
- Error “npm WARN package.json: No repository field”
- How to fix ‘Error: querySrv EREFUSED’ when connecting to MongoDB Atlas?
- Express.js req.ip is returning ::ffff:127.0.0.1
- What is the difference between res.send and res.write in express?
- What is best way to handle global connection of Mongodb in NodeJs
- Call a “local” function within module.exports from another function in module.exports?
- Model.find() returns empty in mongoose [duplicate]
- Why can’t we do multiple response.send in Express.js?
- Node.js: how to limit the HTTP request size and upload file size?
- How to store a file with file extension with multer?