diff --git a/core/templates/layout.base.php b/core/templates/layout.base.php
index b3e2f4da91cd1b4d6a0818881f9eb7bac5b17b62..c519388fa3b20ee767dc5b8257803318871d227e 100644
--- a/core/templates/layout.base.php
+++ b/core/templates/layout.base.php
@@ -30,7 +30,7 @@
 			?>
 		<?php endforeach; ?>
 	</head>
-
+	<?php flush(); ?>
 	<body id="body-public">
 		<?php print_unescaped($_['content']); ?>
 	</body>
diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php
index 5788d1d5bd3aa60f3432b26f75e6d150fed1fc4a..1f89e3f04037726b2bee8a1386a0a4fdbc8c7a8a 100644
--- a/core/templates/layout.guest.php
+++ b/core/templates/layout.guest.php
@@ -32,7 +32,7 @@
 			?>
 		<?php endforeach; ?>
 	</head>
-
+	<?php flush(); ?>
 	<body id="body-login">
 		<div class="wrapper"><!-- for sticky footer -->
 			<header><div id="header">
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index ba5f6ef9b541ae7f9705925ac49e05b84e990969..a217446ca73b70ca58d9ccbfdd8b3bf03f3d00fa 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -35,7 +35,7 @@
 			?>
 		<?php endforeach; ?>
 	</head>
-
+	<?php flush(); ?>
 	<body id="<?php p($_['bodyid']);?>">
 	<noscript><div id="nojavascript"><div><?php print_unescaped($l->t('This application requires JavaScript to be enabled for correct operation.  Please <a href="http://enable-javascript.com/" target="_blank">enable JavaScript</a> and re-load this interface.')); ?></div></div></noscript>
 	<div id="notification-container">