I am using node static for a really simple web app.
I need to server a different index.html for a certain client IP.
This is my code atm.:
var fileServer = new(nodeStatic.Server)();
var app = http.createServer(options, function(req, res) {
// Office IP so I dont need code
var staticIp = "111.11.11.11";
var securityCode = "SECRETKEY";
if (staticIp == req.headers['x-real-ip']) {
// TO DO: Server an other index.html
} else if (req.url.includes(securityCode)) {
fileServer.serve(req, res);
} else {
res.writeHead(200, {"Content-Type": "text/plain"});
res.write("Access Denied");
res.end();
}
}).listen(8443);
The documents say:
For example: