Skip to content

Commit 924dc0a

Browse files
committed
log proxied requests at debug level
1 parent e5367ab commit 924dc0a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/cmd/ecr-proxy/main.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ func main() {
100100
log.Fatal("failed to create a standard logger for the reverse proxy", zap.Error(err))
101101
}
102102

103-
mux.Handle("/v2/", &httputil.ReverseProxy{
103+
reverseProxy := &httputil.ReverseProxy{
104104
Director: func(req *http.Request) {
105105
if err := addAuthToken(req); err != nil {
106106
log.Error("failed to add auth token to request", zap.Error(err))
@@ -115,6 +115,12 @@ func main() {
115115

116116
http.Error(w, "upstream failure", http.StatusBadGateway)
117117
},
118+
}
119+
120+
mux.HandleFunc("/v2/", func(w http.ResponseWriter, req *http.Request) {
121+
log.Debug("proxying request", zap.String("url", req.RequestURI))
122+
123+
reverseProxy.ServeHTTP(w, req)
118124
})
119125

120126
mux.HandleFunc("/health", func(w http.ResponseWriter, req *http.Request) {

0 commit comments

Comments
 (0)