From c9c2696d3614b7d480e6d20e0a813900aa1e035e Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sun, 1 Aug 2021 16:34:37 +0800 Subject: [PATCH] fix: exclude local host --- backend/route.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/route.php b/backend/route.php index a626ca5..fc62438 100644 --- a/backend/route.php +++ b/backend/route.php @@ -5,10 +5,12 @@ include 'kms-web.php'; include 'kms-help.php'; include 'kms-office.php'; +$webSite = "{KMS_HOST}"; if (isset($_SERVER['HTTP_HOST'])) { // 获取服务域名 - $webSite = $_SERVER['HTTP_HOST']; -} else { - $webSite = "{HOST}"; + preg_match('#^127.0.0.1#', $_SERVER['HTTP_HOST'], $match); // 排除127.0.0.1下的host + if (count($match) == 0) { + $webSite = $_SERVER['HTTP_HOST']; + } } $url = $_SERVER['DOCUMENT_URI'];