diff --git a/horizon/middleware.py b/horizon/middleware.py
index <HASH>..<HASH> 100644
--- a/horizon/middleware.py
+++ b/horizon/middleware.py
@@ -70,7 +70,13 @@ class HorizonMiddleware(object):
             # proceed no further if the current request is already known
             # not to be authenticated
             return None
-
+        if request.is_ajax():
+            # if the request is Ajax we do not want to proceed, as clients can
+            #  1) create pages with constant polling, which can create race
+            #     conditions when a page navigation occurs
+            #  2) might leave a user seemingly left logged in forever
+            #  3) thrashes db backed session engines with tons of changes
+            return None
         # If we use cookie-based sessions, check that the cookie size does not
         # reach the max size accepted by common web browsers.
         if (
Fix excessive ajax session thrash

HorizonMiddleware causes excessive session rewrites
and possible race condition resulting in logouts
for ajax requests

Change-Id: I1e<I>a<I>e<I>d<I>bfcf<I>b9a<I>f6aaad<I>
Closes-bug: #<I>