changeset 6407:6ebda1e5b4f3

mod_authz_delegate: Ruse parent host logic from mod_authz_internal
author Kim Alvefur <zash@zash.se>
date Wed, 18 Feb 2026 16:34:37 +0100
parents cab284eaeb81
children 7fe484e7b574
files mod_authz_delegate/README.md mod_authz_delegate/mod_authz_delegate.lua
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_authz_delegate/README.md	Wed Feb 18 16:30:18 2026 +0100
+++ b/mod_authz_delegate/README.md	Wed Feb 18 16:34:37 2026 +0100
@@ -22,3 +22,7 @@
     authorization = "delegate"
     authz_delegate_to = "domain.example"
 ```
+
+The setting `authz_delegate_to` defaults to the hostname with the
+left-most subdomain removed, or the `parent_host` setting like
+[mod_authz_internal][doc:modules:mod_authz_internal].
--- a/mod_authz_delegate/mod_authz_delegate.lua	Wed Feb 18 16:30:18 2026 +0100
+++ b/mod_authz_delegate/mod_authz_delegate.lua	Wed Feb 18 16:34:37 2026 +0100
@@ -1,4 +1,6 @@
-local target_host = assert(module:get_option("authz_delegate_to"));
+local host = module.host;
+local host_suffix = module:get_option_string("parent_host", (host:gsub("^[^%.]+%.", "")));
+local target_host = module:get_option("authz_delegate_to", host_suffix);
 local this_host = module:get_host();
 
 local array = require"util.array";