diff --git a/cas.module b/cas.module
index 27ee065..73abd74 100644
--- a/cas.module
+++ b/cas.module
@@ -15,6 +15,26 @@ define('CAS_LOGIN_DRUPAL_INVITE_DEFAULT', 'Cancel CAS login');
 define('CAS_LOGIN_REDIR_MESSAGE', 'You will be redirected to the secure CAS login page.');
 define('CAS_EXCLUDE', 'services/*');
 
+
+/**
+ * Implementation of hook_boot().
+ * Allow to use CAS gateway mode with cache enabled
+ * @see http://drupal.org/node/1280474
+ */
+function cas_boot() {
+  static $cas_boot_perform = TRUE;
+  global $conf;
+  require_once './includes/path.inc';
+  if($cas_boot_perform && _cas_allow_check_for_login()){
+    $cas_boot_perform = FALSE;
+    // we override the cache setting just for CAS gateway request
+    unset($conf['cache']);
+    $conf['cache']= CACHE_DISABLED;
+    // then we resume the bootstrap phase
+    drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
+  }
+}
+
 /**
  * Implementation of hook_init().
  *
