From 732895297cd50b33c7e17cd0c7fbbd7ad14b675a Mon Sep 17 00:00:00 2001 From: mine <15122691092@163.com> Date: Wed, 18 Dec 2024 11:06:42 +0800 Subject: [PATCH] =?UTF-8?q?config/1=20=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6?= =?UTF-8?q?https?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/controllers/config.js b/controllers/config.js index c5346d2..a79e58c 100644 --- a/controllers/config.js +++ b/controllers/config.js @@ -100,7 +100,7 @@ export default (fastify, options, done) => { console.log(cfg_path); try { // 获取主机名,协议及端口 - const protocol = request.protocol; // http 或 https + const protocol = request.headers['x-forwarded-proto'] || (request.socket.encrypted ? 'https' : 'http'); // http 或 https const hostname = request.hostname; // 主机名,不包含端口 const port = request.socket.localPort; // 获取当前服务的端口 console.log('port:', port);