Monday 10 April 2017

Disable SSL Trusted Peer requirement in specific express router

I'm a newbie to NodeJS(Any JS). I'm trying to develop an app which has multiple routers. Here are my router paths.

var app = express();
var apiRouter = express.Router();
var adminRouter = express.Router();
var pageRouter = express.Router();

app.use('/api', apiRouter);
app.use('/admin', adminRouter);
app.use('/', pageRouter);

apiRouter serve the rest api which will consume in mobile apps. adminRouter serves the admin dash board. pageRouter serves the end users as a landing page and some highlights of the app.

I have implemented SSL Peer implementation as below.

options = {
  key: // Path to key file, 
  ca: // Path to CA crt file, 
  cert: // Path to crt file, 
  requestCert: true, 
  rejectUnauthorized: true
};

How ever I need to remove SSL trusted peer implementation from pageRouter as end user do not have my certification and key. So how can I disable the SSL trusted peer implementation on pageRouter only?



via Chrishan

No comments:

Post a Comment