mirror of
				https://github.com/caddyserver/caddy.git
				synced 2025-11-03 19:17:29 -05:00 
			
		
		
		
	reverseproxy: Add flag to short command to disable redirects (#5330)
Co-authored-by: Francis Lavoie <lavofr@gmail.com> Fixes undefined
This commit is contained in:
		
							parent
							
								
									962310204f
								
							
						
					
					
						commit
						e9d95ab29f
					
				@ -64,6 +64,7 @@ default, all incoming headers are passed through unmodified.)
 | 
				
			|||||||
			fs.Bool("insecure", false, "Disable TLS verification (WARNING: DISABLES SECURITY BY NOT VERIFYING SSL CERTIFICATES!)")
 | 
								fs.Bool("insecure", false, "Disable TLS verification (WARNING: DISABLES SECURITY BY NOT VERIFYING SSL CERTIFICATES!)")
 | 
				
			||||||
			fs.Bool("internal-certs", false, "Use internal CA for issuing certs")
 | 
								fs.Bool("internal-certs", false, "Use internal CA for issuing certs")
 | 
				
			||||||
			fs.Bool("debug", false, "Enable verbose debug logs")
 | 
								fs.Bool("debug", false, "Enable verbose debug logs")
 | 
				
			||||||
 | 
								fs.Bool("disable-redirects", false, "Disable HTTP->HTTPS redirects")
 | 
				
			||||||
			return fs
 | 
								return fs
 | 
				
			||||||
		}(),
 | 
							}(),
 | 
				
			||||||
	})
 | 
						})
 | 
				
			||||||
@ -77,6 +78,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
 | 
				
			|||||||
	insecure := fs.Bool("insecure")
 | 
						insecure := fs.Bool("insecure")
 | 
				
			||||||
	internalCerts := fs.Bool("internal-certs")
 | 
						internalCerts := fs.Bool("internal-certs")
 | 
				
			||||||
	debug := fs.Bool("debug")
 | 
						debug := fs.Bool("debug")
 | 
				
			||||||
 | 
						disableRedir := fs.Bool("disable-redirects")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	httpPort := strconv.Itoa(caddyhttp.DefaultHTTPPort)
 | 
						httpPort := strconv.Itoa(caddyhttp.DefaultHTTPPort)
 | 
				
			||||||
	httpsPort := strconv.Itoa(caddyhttp.DefaultHTTPSPort)
 | 
						httpsPort := strconv.Itoa(caddyhttp.DefaultHTTPSPort)
 | 
				
			||||||
@ -174,6 +176,8 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if fromAddr.Scheme == "http" {
 | 
						if fromAddr.Scheme == "http" {
 | 
				
			||||||
		server.AutoHTTPS = &caddyhttp.AutoHTTPSConfig{Disabled: true}
 | 
							server.AutoHTTPS = &caddyhttp.AutoHTTPSConfig{Disabled: true}
 | 
				
			||||||
 | 
						} else if disableRedir {
 | 
				
			||||||
 | 
							server.AutoHTTPS = &caddyhttp.AutoHTTPSConfig{DisableRedir: true}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	httpApp := caddyhttp.App{
 | 
						httpApp := caddyhttp.App{
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user