]> source.dussan.org Git - vaadin-framework.git/commitdiff
Changed the handleSessionExpired logic to return a 404 instead of a 410 and added... 8.8 8.8.6
authoredler-san <19165931+edler-san@users.noreply.github.com>
Thu, 2 May 2019 11:26:14 +0000 (13:26 +0200)
committerZhe Sun <31067185+ZheSun88@users.noreply.github.com>
Thu, 8 Aug 2019 07:16:07 +0000 (10:16 +0300)
* Changed the handleSessionExpired logic to return a 404 instead of a 410. Also added the no-cache parameter to the reply.
See https://github.com/vaadin/framework/issues/4417 for discussion.

server/src/main/java/com/vaadin/server/communication/HeartbeatHandler.java

index ed2faad05a04d21a274327e376051da82bb59586..07ab4025143583c1e47d104ed4082ec3339905e0 100644 (file)
@@ -89,7 +89,14 @@ public class HeartbeatHandler extends SynchronizedRequestHandler
             return false;
         }
 
-        response.sendError(HttpServletResponse.SC_GONE, "Session expired");
+        // Ensure that the browser does not cache expired response.
+        // iOS 6 Safari requires this (#10370)
+        response.setHeader("Cache-Control", "no-cache");
+        // If Content-Type is not set, browsers assume text/html and may
+        // complain about the empty response body (#12182)
+        response.setHeader("Content-Type", "text/plain");
+
+        response.sendError(HttpServletResponse.SC_NOT_FOUND, "Session expired");
         return true;
     }
 }