Workaround heroku ssl with env var

This commit is contained in:
Mikołaj Pich 2019-01-11 01:29:45 +01:00
parent c71273f701
commit 94a5d76af3
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA

View file

@ -1,5 +1,5 @@
function getProtocol(req) {
let proto = req.connection.encrypted ? 'https' : 'http';
let proto = req.connection.encrypted || process.env.SSL === 'true' ? 'https' : 'http';
// only do this if you trust the proxy
proto = req.headers['x-forwarded-proto'] || proto;
return proto.split(/\s*,\s*/)[0];