test prefix stripping
This commit is contained in:
		
							
								
								
									
										4
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								main.go
									
									
									
									
									
								
							@@ -14,6 +14,7 @@ import (
 | 
				
			|||||||
type myConfig struct {
 | 
					type myConfig struct {
 | 
				
			||||||
	MyURL  string
 | 
						MyURL  string
 | 
				
			||||||
	MySock string
 | 
						MySock string
 | 
				
			||||||
 | 
						Strip  string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func main() {
 | 
					func main() {
 | 
				
			||||||
@@ -21,6 +22,7 @@ func main() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	flag.StringVar(&c.MyURL, "url", "", "URL to proxy to")
 | 
						flag.StringVar(&c.MyURL, "url", "", "URL to proxy to")
 | 
				
			||||||
	flag.StringVar(&c.MySock, "unix", "", "Unix socket to listen on")
 | 
						flag.StringVar(&c.MySock, "unix", "", "Unix socket to listen on")
 | 
				
			||||||
 | 
						flag.StringVar(&c.Strip, "strip", "", "Strip prefix from reqeusts")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	flag.Parse()
 | 
						flag.Parse()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -43,7 +45,7 @@ func main() {
 | 
				
			|||||||
		WriteTimeout:      3 * time.Second,
 | 
							WriteTimeout:      3 * time.Second,
 | 
				
			||||||
		IdleTimeout:       30 * time.Second,
 | 
							IdleTimeout:       30 * time.Second,
 | 
				
			||||||
		ReadHeaderTimeout: 20 * time.Second,
 | 
							ReadHeaderTimeout: 20 * time.Second,
 | 
				
			||||||
		Handler:           frontendProxy,
 | 
							Handler:           http.StripPrefix(c.Strip, frontendProxy),
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	unixListener, err := net.Listen("unix", c.MySock)
 | 
						unixListener, err := net.Listen("unix", c.MySock)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user