diff --git a/manifests/named_vhost.pp b/manifests/named_vhost.pp
index 4caaa0982effc87c9ea99d5ae2c62f595bcc7d2e..64a060b5b90e617a0b9c1b2fce92dee9331e1db2 100644
--- a/manifests/named_vhost.pp
+++ b/manifests/named_vhost.pp
@@ -1,4 +1,4 @@
-# Copyright (C) 2014-2022 Thomas Bellman.
+# Copyright (C) 2014-2024 Thomas Bellman.
 # Licensed under the GNU LGPL v3+; see the README file for more information.
 
 
@@ -10,9 +10,11 @@
  *  - urls
  *    Specifies one or more addresses that this virtual host handles, i.e.
  *    which 'Listen' directives apply to it, on the format of URLs, in the
- *    same format as apache::listen does.  Listen directives must however
- *    be configured separately; this definition does not do that for you.
- *    This parameter can be either a single URL, or a list of URLs.
+ *    same format as apache::listen does.  apache::listen will be called
+ *    automatically, so you don't need to do that separately (this is a new
+ *    behaviour since 2024).
+ *    This parameter can be either a single URL, or a (possibly nested)
+ *    list of URLs.
  *
  *  - servernames
  *    Which hostnames in URLs this virtual host applies to.  Translates
@@ -62,6 +64,10 @@ define apache::named_vhost($urls,
 	    if $certname {
 		include x509certs
 	    }
+	    apache::listen {
+		"_vhost-${name}":
+		    urls => $urls;
+	    }
 	    apache::include_file {
 		"vhost-${name}":
 		    content => template('apache/named_vhost.conf.erb'),
@@ -69,6 +75,10 @@ define apache::named_vhost($urls,
 	    }
 	}
 	'absent': {
+	    apache::listen {
+		"_vhost-${name}":
+		    ensure => absent;
+	    }
 	    apache::include_file {
 		"vhost-${name}":
 		    ensure => absent;