Simplify processes in the getter request.protocol
(#1203)
This commit is contained in:
parent
4d42500e76
commit
77a4cfb829
1 changed files with 3 additions and 4 deletions
|
@ -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';
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue