Browse Source
			
			
			reverseproxy: Minor tweaks
			
				We'll need that context in v2.1 when the transport can manage its own
client certificates; see #3198
			
			
				master
			
			
		 
		
			
				
					
						 Matthew Holt
					
					6 years ago
						Matthew Holt
					
					6 years ago
					
				 
				
			 
		 
		
			
				
					
					No known key found for this signature in database
					
						
							GPG Key ID: 2A349DD577D586A5
						
					
				
			
		
		
		
	
		
			
				 2 changed files with 
4 additions and 
4 deletions
			 
			
		 
		
			
				- 
					
					
					 
					modules/caddyhttp/reverseproxy/command.go
				
- 
					
					
					 
					modules/caddyhttp/reverseproxy/httptransport.go
				
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -121,7 +121,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) { | 
			
		
	
		
			
				
					|  |  |  | 	urlHost := fromURL.Hostname() | 
			
		
	
		
			
				
					|  |  |  | 	if urlHost != "" { | 
			
		
	
		
			
				
					|  |  |  | 		route.MatcherSetsRaw = []caddy.ModuleMap{ | 
			
		
	
		
			
				
					|  |  |  | 			caddy.ModuleMap{ | 
			
		
	
		
			
				
					|  |  |  | 			{ | 
			
		
	
		
			
				
					|  |  |  | 				"host": caddyconfig.JSON(caddyhttp.MatchHost{urlHost}, nil), | 
			
		
	
		
			
				
					|  |  |  | 			}, | 
			
		
	
		
			
				
					|  |  |  | 		} | 
			
		
	
	
		
			
				
					|  |  | 
 | 
			
		
	
								
							
						
					 
					
				 
			 
		
			
			
			
			
			
			
				
				
					
						
							
								
									
	
		
			
				
					|  |  | @ -99,12 +99,12 @@ func (HTTPTransport) CaddyModule() caddy.ModuleInfo { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | // Provision sets up h.Transport with a *http.Transport
 | 
			
		
	
		
			
				
					|  |  |  | // that is ready to use.
 | 
			
		
	
		
			
				
					|  |  |  | func (h *HTTPTransport) Provision(_ caddy.Context) error { | 
			
		
	
		
			
				
					|  |  |  | func (h *HTTPTransport) Provision(ctx caddy.Context) error { | 
			
		
	
		
			
				
					|  |  |  | 	if len(h.Versions) == 0 { | 
			
		
	
		
			
				
					|  |  |  | 		h.Versions = []string{"1.1", "2"} | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 	rt, err := h.NewTransport() | 
			
		
	
		
			
				
					|  |  |  | 	rt, err := h.NewTransport(ctx) | 
			
		
	
		
			
				
					|  |  |  | 	if err != nil { | 
			
		
	
		
			
				
					|  |  |  | 		return err | 
			
		
	
		
			
				
					|  |  |  | 	} | 
			
		
	
	
		
			
				
					|  |  | @ -115,7 +115,7 @@ func (h *HTTPTransport) Provision(_ caddy.Context) error { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | // NewTransport builds a standard-lib-compatible
 | 
			
		
	
		
			
				
					|  |  |  | // http.Transport value from h.
 | 
			
		
	
		
			
				
					|  |  |  | func (h *HTTPTransport) NewTransport() (*http.Transport, error) { | 
			
		
	
		
			
				
					|  |  |  | func (h *HTTPTransport) NewTransport(_ caddy.Context) (*http.Transport, error) { | 
			
		
	
		
			
				
					|  |  |  | 	dialer := &net.Dialer{ | 
			
		
	
		
			
				
					|  |  |  | 		Timeout:       time.Duration(h.DialTimeout), | 
			
		
	
		
			
				
					|  |  |  | 		FallbackDelay: time.Duration(h.FallbackDelay), | 
			
		
	
	
		
			
				
					|  |  | 
 |