@@ -338,7 +338,38 @@ func (st *ServerType) listenersForServerBlockAddress(sblock serverBlock, addr Ad
338338 if err != nil {
339339 return nil , fmt .Errorf ("parsing network address: %v" , err )
340340 }
341- if _ , ok := listeners [addr .String ()]; ! ok {
341+
342+ // Check if this is an interface with multi-address modes - expand to multiple IPs
343+ if networkAddr .IsInterfaceNetwork () && strings .Contains (networkAddr .Host , caddy .InterfaceDelimiter ) {
344+ parts := strings .SplitN (networkAddr .Host , caddy .InterfaceDelimiter , 2 )
345+ if len (parts ) == 2 {
346+ mode := caddy .InterfaceBindingMode (parts [1 ])
347+ // Check if this mode returns multiple addresses
348+ if mode == caddy .InterfaceBindingAll || mode == caddy .InterfaceBindingIPv4 || mode == caddy .InterfaceBindingIPv6 {
349+ // Resolve IPs for the interface with the specified mode
350+ ipAddresses , err := caddy .ResolveInterfaceNameWithMode (parts [0 ], mode )
351+ if err != nil {
352+ return nil , fmt .Errorf ("resolving interface %s with mode '%s': %v" , parts [0 ], mode , err )
353+ }
354+
355+ // Create a listener for each IP
356+ for _ , ip := range ipAddresses {
357+ ipNA := networkAddr
358+ ipNA .Host = ip
359+ if _ , ok := listeners [ipNA .String ()]; ! ok {
360+ listeners [ipNA .String ()] = map [string ]struct {}{}
361+ }
362+ for _ , protocol := range lnCfgVal .protocols {
363+ listeners [ipNA .String ()][protocol ] = struct {}{}
364+ }
365+ }
366+ continue
367+ }
368+ }
369+ }
370+
371+ // Normal case - single address
372+ if _ , ok := listeners [networkAddr .String ()]; ! ok {
342373 listeners [networkAddr .String ()] = map [string ]struct {}{}
343374 }
344375 for _ , protocol := range lnCfgVal .protocols {
0 commit comments