From 969a2462c5eddaf47e1b221e9803c5383d57af40 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 8 Jul 2020 13:37:37 -0400 Subject: [PATCH] test prefix stripping --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0e69449..6bb6221 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( type myConfig struct { MyURL string MySock string + Strip string } func main() { @@ -21,6 +22,7 @@ func main() { flag.StringVar(&c.MyURL, "url", "", "URL to proxy to") flag.StringVar(&c.MySock, "unix", "", "Unix socket to listen on") + flag.StringVar(&c.Strip, "strip", "", "Strip prefix from reqeusts") flag.Parse() @@ -43,7 +45,7 @@ func main() { WriteTimeout: 3 * time.Second, IdleTimeout: 30 * time.Second, ReadHeaderTimeout: 20 * time.Second, - Handler: frontendProxy, + Handler: http.StripPrefix(c.Strip, frontendProxy), } unixListener, err := net.Listen("unix", c.MySock)