diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php
index 59257907ad..912c7d0f6d 100755
--- a/pandora_console/general/login_page.php
+++ b/pandora_console/general/login_page.php
@@ -114,12 +114,6 @@ foreach ($custom_fields as $field) {
     }
 }
 
-// Connection lost alert.
-ui_require_css_file('register', 'include/styles/', true);
-ui_require_javascript_file('connection_check');
-$conn_title = __('Connection with server has been lost');
-$conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
-ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
 
 // Get the custom icons.
 $docs_logo = ui_get_docs_logo();
diff --git a/pandora_console/include/connection_check.php b/pandora_console/include/connection_check.php
new file mode 100644
index 0000000000..e7fd5aba9b
--- /dev/null
+++ b/pandora_console/include/connection_check.php
@@ -0,0 +1,23 @@
+<?php
+
+// Pandora FMS - http://pandorafms.com
+// ==================================================
+// Copyright (c) 2005-2011 Artica Soluciones Tecnologicas
+// Please see http://pandorafms.org for full contribution list
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; version 2
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+require_once 'functions.php';
+
+
+if (check_login(false)) {
+    $return = true;
+} else {
+    $return = false;
+}
+
+echo json_encode($return);
diff --git a/pandora_console/include/javascript/connection_check.js b/pandora_console/include/javascript/connection_check.js
index 5ea72d2184..65b893ef51 100644
--- a/pandora_console/include/javascript/connection_check.js
+++ b/pandora_console/include/javascript/connection_check.js
@@ -29,22 +29,30 @@ function handleConnection() {
   var connected;
   var msg = "online";
 
+  var homeurl = getServerUrl();
+  if (homeurl == null || homeurl == "") {
+    return;
+  }
+
   if (navigator.onLine) {
-    isReachable(getServerUrl())
-      .then(function(online) {
-        if (online) {
-          // handle online status
-          connected = true;
-          showConnectionMessage(connected, msg);
-        } else {
-          connected = false;
-          msg = "No connectivity with server";
-          showConnectionMessage(connected, msg);
-        }
+    $.ajax({
+      url: homeurl + "include/connection_check.php",
+      type: "post",
+      dataType: "json"
+    })
+      .done(function(response) {
+        connected = true;
+        showConnectionMessage(connected, msg);
       })
-      .catch(function(err) {
-        connected = false;
-        msg = err;
+      .fail(function(err) {
+        // If test connection file is not found, do not show message.
+        if (err.status != 404) {
+          connected = false;
+          msg = err;
+        } else {
+          connected = true;
+        }
+
         showConnectionMessage(connected, msg);
       });
   } else {
@@ -55,38 +63,17 @@ function handleConnection() {
   }
 }
 
-/**
- * Test server reachibilty and get response.
- *
- * @param {String} url
- *
- * Return {promise}
- */
-function isReachable(url) {
-  /**
-   * Note: fetch() still "succeeds" for 404s on subdirectories,
-   * which is ok when only testing for domain reachability.
-   *
-   * Example:
-   *   https://google.com/noexist does not throw
-   *   https://noexist.com/noexist does throw
-   */
-  return fetch(url, { method: "HEAD", mode: "no-cors" })
-    .then(function(resp) {
-      return resp && (resp.ok || resp.type === "opaque");
-    })
-    .catch(function(error) {
-      console.warn("[conn test failure]:", error);
-    });
-}
-
 /**
  * Gets server origin url
  */
 function getServerUrl() {
   var server_url;
 
-  server_url = window.location.origin;
+  try {
+    server_url = get_php_value("absolute_homeurl");
+  } catch (error) {
+    return "";
+  }
 
   return server_url;
 }
@@ -99,7 +86,7 @@ function getServerUrl() {
  */
 function showConnectionMessage(conn = true, msg = "") {
   var data = {};
-  if (conn) {
+  if (conn && closed == false) {
     $("div#message_dialog_connection")
       .closest(".ui-dialog-content")
       .dialog("close");
@@ -164,6 +151,7 @@ function infoMessage(data, idMsg) {
       },
       close: function(event, ui) {
         $(".ui-widget-overlay").removeClass("error-modal-opened");
+        closed = true;
       }
     })
     .show();
diff --git a/pandora_console/index.php b/pandora_console/index.php
index 233f554749..fa7f6fa8af 100755
--- a/pandora_console/index.php
+++ b/pandora_console/index.php
@@ -1274,6 +1274,7 @@ echo '</div>';
 
 // Connection lost alert.
 ui_require_javascript_file('connection_check');
+set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
 $conn_title = __('Connection with server has been lost');
 $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
 ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
diff --git a/pandora_console/operation/agentes/stat_win.php b/pandora_console/operation/agentes/stat_win.php
index a75e30e269..fce948feb1 100644
--- a/pandora_console/operation/agentes/stat_win.php
+++ b/pandora_console/operation/agentes/stat_win.php
@@ -87,6 +87,7 @@ ui_require_css_file('register', 'include/styles/', true);
 $conn_title = __('Connection with server has been lost');
 $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
 ui_require_javascript_file('connection_check');
+set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
 ui_print_message_dialog(
     $conn_title,
     $conn_text,
diff --git a/pandora_console/operation/events/sound_events.php b/pandora_console/operation/events/sound_events.php
index 7434c18eaf..ef569fc30a 100644
--- a/pandora_console/operation/events/sound_events.php
+++ b/pandora_console/operation/events/sound_events.php
@@ -66,6 +66,7 @@ ui_require_css_file('register', 'include/styles/', true);
 $conn_title = __('Connection with server has been lost');
 $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
 ui_require_javascript_file('connection_check');
+set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
 ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
 
 $table = new StdClass;
diff --git a/pandora_console/operation/gis_maps/public_console.php b/pandora_console/operation/gis_maps/public_console.php
index a756d04c0c..116f172795 100755
--- a/pandora_console/operation/gis_maps/public_console.php
+++ b/pandora_console/operation/gis_maps/public_console.php
@@ -277,6 +277,7 @@ if ($layers != false) {
     $conn_title = __('Connection with server has been lost');
     $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
     ui_require_javascript_file('connection_check');
+    set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
     ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
 }
 
diff --git a/pandora_console/operation/visual_console/legacy_public_view.php b/pandora_console/operation/visual_console/legacy_public_view.php
index 609447800e..0a3aa56328 100644
--- a/pandora_console/operation/visual_console/legacy_public_view.php
+++ b/pandora_console/operation/visual_console/legacy_public_view.php
@@ -49,6 +49,7 @@ $url_css_modal = ui_get_full_url('include/styles/register.css', false, false, fa
 echo '<link rel="stylesheet" href="'.$url_css_modal.'" type="text/css" />';
 // Connection lost alert.
 ui_require_javascript_file('connection_check', 'include/javascript/', true);
+set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
 $conn_title = __('Connection with server has been lost');
 $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
 ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');
diff --git a/pandora_console/operation/visual_console/public_view.php b/pandora_console/operation/visual_console/public_view.php
index 6cc9f817a1..64c7181743 100644
--- a/pandora_console/operation/visual_console/public_view.php
+++ b/pandora_console/operation/visual_console/public_view.php
@@ -33,6 +33,7 @@ ui_require_css_file('register', 'include/styles/', true);
 
 // Connection lost alert.
 ui_require_javascript_file('connection_check', 'include/javascript/', true);
+set_js_value('absolute_homeurl', ui_get_full_url(false, false, false, false));
 $conn_title = __('Connection with server has been lost');
 $conn_text = __('Connection to the server has been lost. Please check your internet connection or contact with administrator.');
 ui_print_message_dialog($conn_title, $conn_text, 'connection', '/images/error_1.png');