From b2275a1d87de1a6da82200413529e1563cb2357f Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 30 Jul 2016 22:59:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E7=BB=91=E5=AE=9A=E6=94=AF?= =?UTF-8?q?=E6=8C=81https=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index c9e58cda..f63e37e1 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -13,6 +13,7 @@ namespace think; use think\App; use think\Config; +use think\exception\HttpException; use think\Hook; use think\Log; use think\Request; @@ -680,9 +681,13 @@ class Route } } if (!empty($item)) { - self::$domain = true; + self::$domain = true; + // 解析子域名部署规则 list($rule, $option, $pattern) = $item; - // 子域名部署规则 + if (!empty($option['https']) && !$request->isSsl()) { + // https检测 + throw new HttpException(404, 'must use https request:' . $host); + } if ($rule instanceof \Closure) { // 执行闭包 $reflect = new \ReflectionFunction($rule);