diff --git a/lib/request.js b/lib/request.js index 16be9a2..7881d4c 100644 --- a/lib/request.js +++ b/lib/request.js @@ -397,11 +397,10 @@ module.exports = { */ get protocol() { - const proxy = this.app.proxy; if (this.socket.encrypted) return 'https'; - if (!proxy) return 'http'; - const proto = this.get('X-Forwarded-Proto') || 'http'; - return proto.split(/\s*,\s*/)[0]; + if (!this.app.proxy) return 'http'; + const proto = this.get('X-Forwarded-Proto'); + return proto ? proto.split(/\s*,\s*/)[0] : 'http'; }, /**