mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-10-31 10:37:24 -04:00 
			
		
		
		
	close #64
This commit is contained in:
		
							parent
							
								
									b2ee6638e4
								
							
						
					
					
						commit
						a5a90fe6fc
					
				| @ -5,6 +5,7 @@ package headers | ||||
| 
 | ||||
| import ( | ||||
| 	"net/http" | ||||
| 	"strings" | ||||
| 
 | ||||
| 	"github.com/mholt/caddy/middleware" | ||||
| ) | ||||
| @ -22,7 +23,11 @@ func (h Headers) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) | ||||
| 	for _, rule := range h.Rules { | ||||
| 		if middleware.Path(r.URL.Path).Matches(rule.Url) { | ||||
| 			for _, header := range rule.Headers { | ||||
| 				w.Header().Set(header.Name, header.Value) | ||||
| 				if strings.HasPrefix(header.Name, "-") { | ||||
| 					w.Header().Del(strings.TrimLeft(header.Name, "-")) | ||||
| 				} else { | ||||
| 					w.Header().Set(header.Name, header.Value) | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user