From da40e09014df936a8b58daef4fd93fd96661be43 Mon Sep 17 00:00:00 2001
From: Alan Bell <alanbell@ubuntu.com>
Date: Thu, 22 Oct 2015 15:14:29 +0100
Subject: [PATCH] fix #9 redirect to configured site url if the protocol or
 host is wrong

---
 includes/main/WebUI.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/includes/main/WebUI.php b/includes/main/WebUI.php
index 2455ef52b..6393ec94c 100644
--- a/includes/main/WebUI.php
+++ b/includes/main/WebUI.php
@@ -103,6 +103,12 @@ class Vtiger_WebUI extends Vtiger_EntryPoint {
 		// common utils api called, depend on this variable right now
 		$currentUser = $this->getLogin();
 		vglobal('current_user', $currentUser);
+                //check we are being connected to on the right host and protocol
+                global $site_URL;
+                if ((stripos($site_URL,$_SERVER['REQUEST_SCHEME']."://".$_SERVER['HTTP_HOST']) !== 0)){
+                    header("Location: $site_URL",TRUE,301);
+                    die();
+                }
 
 		global $default_language;
 		vglobal('default_language', $default_language);
-- 
GitLab