Skip to content

Commit

Permalink
make error verbose if upstream proxy can not be connected
Browse files Browse the repository at this point in the history
  • Loading branch information
darren committed Feb 8, 2019
1 parent 8624448 commit 030d5d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,12 @@ func (s *Server) handleHTTP(w http.ResponseWriter, req *http.Request) {
}
}

log.Printf("[%s] %s %v FAILED: %v", req.RemoteAddr, req.Method, req.URL, perr)
http.Error(w, "No Proxy Available", http.StatusServiceUnavailable)
if perr != nil {
log.Printf("[%s] %s %v FAILED: %v", req.RemoteAddr, req.Method, req.URL, perr)
http.Error(w, perr.Error(), http.StatusServiceUnavailable)
} else {
http.Error(w, "No proxy found", http.StatusServiceUnavailable)
}
}

func (s *Server) watch() {
Expand Down

0 comments on commit 030d5d5

Please sign in to comment.