小程序微信后台和代理后台使用同一个域名
This commit is contained in:
@@ -73,7 +73,7 @@ class apiBase
|
||||
// 静态初始化 domain
|
||||
public static function initDomain() {
|
||||
if (empty(self::$domain)) {
|
||||
self::$domain = env('SITE_SDK_DOMAIN', 'sdk.tscce.cn');
|
||||
self::$domain = env('SITE_SDK_DOMAIN');
|
||||
}
|
||||
}
|
||||
public $devkey; // 开发者Key
|
||||
@@ -101,7 +101,9 @@ class apiBase
|
||||
|
||||
$request_scheme = $is_https ? 'https://' : 'http://';
|
||||
$hostname = $_SERVER['SERVER_NAME'];
|
||||
$hostport = (($is_https && '443' == $_SERVER['SERVER_PORT']) || (!$is_https && '80' == $_SERVER['SERVER_PORT'])) ? '' : ':' . intval($_SERVER['SERVER_PORT']);
|
||||
// 反向代理场景:用转发端口判断,避免生成 https://host:80 这类错误 URL
|
||||
$port = isset($_SERVER['HTTP_X_FORWARDED_PORT']) ? $_SERVER['HTTP_X_FORWARDED_PORT'] : $_SERVER['SERVER_PORT'];
|
||||
$hostport = (($is_https && '443' == $port) || (!$is_https && '80' == $port)) ? '' : ':' . intval($port);
|
||||
|
||||
if ($always_http)
|
||||
return 'http://' . $hostname . $hostport;
|
||||
|
||||
Reference in New Issue
Block a user