diff --git a/modules/core/www/postredirect.php b/modules/core/www/postredirect.php
index aa4ec28e50a3f50c2162956033c4e5f57aeca3ff..ac2439b93f69246cc394491f4f061bf1c4de58bb 100644
--- a/modules/core/www/postredirect.php
+++ b/modules/core/www/postredirect.php
@@ -44,7 +44,7 @@ assert(is_array($postData));
 assert(array_key_exists('url', $postData));
 assert(array_key_exists('post', $postData));
 
-if (!\SimpleSAML\Utils\HTTP::isValidURL($destination)) {
+if (!\SimpleSAML\Utils\HTTP::isValidURL($postData['url'])) {
     throw new \SimpleSAML\Error\Exception('Invalid destination URL.');
 }