http to https redirection for Hapi servers behind a reverse proxy. Any incoming request with 'http' in X-Forwarded-Proto will be redirected (301) to the same host and path with 'https' as the protocol.
To use this plugin you need to register it after you have created your server.
//other imports
const redirect = require('hapi-require-https');
//create your server
//register the plugin to redirect all http trafic to https
server.register(redirect, function (error) {
console.log(error);
})