Skip to content

Instantly share code, notes, and snippets.

@ganeshkbhat
Created October 4, 2018 03:05
Show Gist options
  • Select an option

  • Save ganeshkbhat/4e0ed36edf448e73afd23840f2d452cd to your computer and use it in GitHub Desktop.

Select an option

Save ganeshkbhat/4e0ed36edf448e73afd23840f2d452cd to your computer and use it in GitHub Desktop.
ExpressJS Series: Getting the req.protocol
app.post("/someUrl", function(req, res) {
let protocol = req.protocol;
if (protocol !== 'https') {
res.status(426).send("Protocol Insecure");
}
res.send(200).send({result: 'Success', protocol: protocol});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment