diff --git a/www/wsfed/sp/prp.php b/www/wsfed/sp/prp.php
index d2fea79cadda309e57f4e03cc603ee77fae0f510..06c1aa5ccfdff0c365e4811a9e3024643c0af95b 100644
--- a/www/wsfed/sp/prp.php
+++ b/www/wsfed/sp/prp.php
@@ -24,7 +24,12 @@ if (!$config->getBoolean('enable.wsfed-sp', false))
 	throw new SimpleSAML_Error_Error('NOACCESS');
 
 if (!empty($_GET['wa']) and ($_GET['wa'] == 'wsignoutcleanup1.0')) {
-	print 'Logged Out';
+	if (isset($session) && $session->isValid('wsfed')) {
+		$session->doLogout('wsfed');
+	}
+	if (!empty($_GET['wreply'])) {
+		SimpleSAML_Utilities::redirect(urldecode($_GET['wreply']));
+	}
 	exit;
 }