Last active
September 19, 2018 08:38
-
-
Save praveenkumar/6ede0d17859b45f42b1b2c18b86887c5 to your computer and use it in GitHub Desktop.
proxy.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -46,10 +46,18 @@ func StartProxy(proxyPort int, proxyUpstreamAddr string) { | |
// set custom CA | |
setCA(minishiftTLS.CACert, minishiftTLS.CAKey) | |
+ f, err := goos.OpenFile("/tmp/proxy_access.log", goos.O_APPEND|goos.O_CREATE|goos.O_WRONLY, 0644) | |
+ if err != nil { | |
+ log.Fatal(err) | |
+ } | |
+ | |
+ logger := log.New(f, "proxy", log.Lshortfile) | |
+ | |
proxy := goproxy.NewProxyHttpServer() | |
proxy.Verbose = true | |
proxy.KeepProxyHeaders = true | |
proxy.OnRequest().HandleConnect(goproxy.AlwaysMitm) | |
+ proxy.Logger = logger | |
bindAddr := fmt.Sprintf("0.0.0.0:%d", proxyPort) | |
chain := "" // for logging | |
@@ -87,8 +95,8 @@ func StartProxy(proxyPort int, proxyUpstreamAddr string) { | |
})) | |
} | |
- log.Println(fmt.Sprintf("Serving as HTTP proxy on %s%s", bindAddr, chain)) | |
- log.Fatal(http.ListenAndServe(bindAddr, proxy)) | |
+ logger.Println(fmt.Sprintf("Serving as HTTP proxy on %s%s", bindAddr, chain)) | |
+ logger.Fatal(http.ListenAndServe(bindAddr, proxy)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment