Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/env node
var http = require('http'),
httpProxy = require('http-proxy'),
express = require('express'),
cookieParser = require('cookie-parser'),
crypto = require('crypto'),
path = require('path'),
tcpPortUsed = require('tcp-port-used');
httpProxy.prototype.onError = function (err) {
console.error("Error during connection:", err.code);
}
var app = express();
var http = require('http');
app.use(cookieParser());
app.use(function (req, res, next) {
var rasid = req.cookies['RASID'];
if (rasid === undefined) {
console.log("Generating RASID");
res.cookie("RASID", crypto.randomBytes(40).toString("hex"));
}
next();
});