@@ -266,9 +266,9 @@ public function doAction()
266266 if (substr ($ host , 0 , 2 ) == "*. " ) {
267267 // hdr(host) -m reg -i ^[^\.]+\.example\.org$
268268 // hdr(host) -m reg -i ^[^\.]+\.example\.org(:[0-9]+)?$
269- $ hostACL = "hdr(host) -m reg -i ^[^\.]+ " .str_replace (". " , "\. " , substr ($ host , 1 ))."(:[0-9]+)?$ " ;
269+ $ hostACL = "hdr(host) -m reg -i ^[^\.]+ " .str_replace ([ ". " , "- " ], [ " \. ", " \- " ] , substr ($ host , 1 ))."(:[0-9]+)?$ " ;
270270 } else {
271- $ hostACL = "hdr(host) -m reg -i ^ " .str_replace (". " , "\. " , $ host )."(:[0-9]+)?$ " ;
271+ $ hostACL = "hdr(host) -m reg -i ^ " .str_replace ([ ". " , "- " ], [ " \. ", " \- " ] , $ host )."(:[0-9]+)?$ " ;
272272 }
273273
274274 // https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
@@ -319,7 +319,7 @@ public function doAction()
319319 // hdr(host) -m reg -i ^[^\.]+\.example\.org$
320320 // hdr(host) -m reg -i ^[^\.]+\.example\.org(:[0-9]+)?$
321321 // sni should never have the port on the end as the host header may have
322- $ hostACL = "req_ssl_sni -m reg -i ^[^\.]+ " .str_replace (". " , "\. " , substr ($ host , 1 ));
322+ $ hostACL = "req_ssl_sni -m reg -i ^[^\.]+ " .str_replace ([ ". " , "- " ], [ " \. ", " \- " ] , substr ($ host , 1 ));
323323 } else {
324324 $ hostACL = "req_ssl_sni -m str -i $ {host}" ; // exact match case-insensitive
325325 }
0 commit comments