0.0.0 • Published 7 years ago

is-ssl v0.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

is-https

Check if the given request is HTTPS

npm npm (scoped with tag)

Usage

Install package

yarn add is-https # or npm install is-https

Exported function blueprint is isHTTPS (req, xForwardedProto = true): Boolean.

Behaviour

This function tries to use 3 standard checks for HTTPS detection:

  • Test if req.connection.encrypted is true
  • Test if req.protocol is https
  • Test if x-forwarded-proto header contains https (Only when xForwardedProto argument is true)

Return value:

  • If one of tests is passing, function return true
  • If all tests are unavailable, function returns null
  • Else function returns false

License

MIT - Nuxt.js