Skip to content

Commit a505938

Browse files
committed
[feature] add HEAD and allow connection reuse if closed (issues/4)
1 parent 09cf1ba commit a505938

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

go/socket-proxy/main.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func httpProxyBlockedPaths(url string) bool {
101101
func httpProxy(w http.ResponseWriter, r *http.Request){
102102
method := r.Method
103103
url := r.URL.String()
104-
if(method == "GET" && !httpProxyBlockedPaths(url)){
104+
if((method == "GET" || method == "HEAD") && !httpProxyBlockedPaths(url)){
105105
proxy.ServeHTTP(w, r)
106106
}else{
107107
log.Printf("blocked: %s %s", method, url)
@@ -125,7 +125,7 @@ func main(){
125125
}
126126
os.Exit(0)
127127
}else{
128-
log.Println("starting ...")
128+
log.Println("starting socket-proxy v" + os.Getenv("APP_VERSION"))
129129
// setup signal handler
130130
signals()
131131

@@ -139,7 +139,8 @@ func main(){
139139
proxy = httputil.NewSingleHostReverseProxy(localhost)
140140
proxy.Transport = &http.Transport{
141141
DialContext: func(_ context.Context, _, _ string)(net.Conn, error){
142-
return dockerSocket, nil
142+
dockerSocket, err = docketSockerDialer.Dial("unix", os.Getenv("SOCKET_PROXY_DOCKER_SOCKET"))
143+
return dockerSocket, err
143144
},
144145
}
145146

0 commit comments

Comments
 (0)