Skip to content

Commit 7328952

Browse files
authored
config/1 判断是否https
1 parent 9549de0 commit 7328952

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: controllers/config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default (fastify, options, done) => {
100100
console.log(cfg_path);
101101
try {
102102
// 获取主机名,协议及端口
103-
const protocol = request.protocol; // http 或 https
103+
const protocol = request.headers['x-forwarded-proto'] || (request.socket.encrypted ? 'https' : 'http'); // http 或 https
104104
const hostname = request.hostname; // 主机名,不包含端口
105105
const port = request.socket.localPort; // 获取当前服务的端口
106106
console.log('port:', port);

0 commit comments

Comments
 (0)