mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 10:37:24 -04:00 
			
		
		
		
	httpcaddyfile: Warn if site address uses unspecified IP (close #4004)
This commit is contained in:
		
							parent
							
								
									55e49ff5c8
								
							
						
					
					
						commit
						c986110678
					
				| @ -17,6 +17,7 @@ package httpcaddyfile | |||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"log" | ||||||
| 	"reflect" | 	"reflect" | ||||||
| 	"regexp" | 	"regexp" | ||||||
| 	"sort" | 	"sort" | ||||||
| @ -471,6 +472,13 @@ func (st *ServerType) serversFromPairings( | |||||||
| 
 | 
 | ||||||
| 			hosts := sblock.hostsFromKeys(false) | 			hosts := sblock.hostsFromKeys(false) | ||||||
| 
 | 
 | ||||||
|  | 			// emit warnings if user put unspecified IP addresses; they probably want the bind directive | ||||||
|  | 			for _, h := range hosts { | ||||||
|  | 				if h == "0.0.0.0" || h == "::" { | ||||||
|  | 					log.Printf("[WARNING] Site block has unspecified IP address %s which only matches requests having that Host header; you probably want the 'bind' directive to configure the socket", h) | ||||||
|  | 				} | ||||||
|  | 			} | ||||||
|  | 
 | ||||||
| 			// tls: connection policies | 			// tls: connection policies | ||||||
| 			if cpVals, ok := sblock.pile["tls.connection_policy"]; ok { | 			if cpVals, ok := sblock.pile["tls.connection_policy"]; ok { | ||||||
| 				// tls connection policies | 				// tls connection policies | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user