Browse Source
			
			
			headers: Trim any trailing colon from field names as a courtesy
			
			
				master
			
			
		 
		
			
				
					
						 Matthew Holt
					
					6 years ago
						Matthew Holt
					
					6 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 2A349DD577D586A5
						
					
				
			
		
		
		
	
		
			
				 1 changed files with 
6 additions and 
0 deletions
			 
			
		 
		
			
				- 
					
					
					 
					modules/caddyhttp/headers/caddyfile.go
				
				
				
					
						
							
								
									
	
		
		
			
				
					|  | @ -111,6 +111,12 @@ func parseReqHdrCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, | 
			
		
	
		
		
			
				
					|  |  | 			return nil, h.ArgErr() |  |  | 			return nil, h.ArgErr() | 
			
		
	
		
		
			
				
					|  |  | 		} |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  | 		field := h.Val() |  |  | 		field := h.Val() | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		// sometimes it is habitual for users to suffix a field name with a colon,
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		// as if they were writing a curl command or something; see
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		// https://caddy.community/t/v2-reverse-proxy-please-add-cors-example-to-the-docs/7349
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		field = strings.TrimSuffix(field, ":") | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 		var value, replacement string |  |  | 		var value, replacement string | 
			
		
	
		
		
			
				
					|  |  | 		if h.NextArg() { |  |  | 		if h.NextArg() { | 
			
		
	
		
		
			
				
					|  |  | 			value = h.Val() |  |  | 			value = h.Val() | 
			
		
	
	
		
		
			
				
					|  | 
 |