App Engine Flex не поддерживает опцию secure: всегда для App Engine Standard он поддерживает.
С помощью Sails созданы политики для перенаправления со ссылкой John Hanley Answer
config / env / production. JS
module.exports = {
...
......
.........
policies:{
'*': 'isHTTPS'
}
}
API / политики / isHTTPS.js
module.exports = function(req, res, next) {
var schema = req.headers['x-forwarded-proto'] || '';
if (schema === 'https') {
// if its a request from myweb.backend.appspot.com
if (req.headers.host !== 'myweb.com') {
res.redirect('https://' + 'myweb.com' + req.url);
} else {
next();
}
} else {
// Redirect to https.
res.redirect('https://' + ((req.headers.host !== 'myweb.com') ? 'myweb.com' : req.headers.host) + req.url);
}
};