Skip to content

Commit

Permalink
Merge pull request #161 from ipfs-force-community/feat/add-more-log-f…
Browse files Browse the repository at this point in the history
…or-proxy

feat: add more log for proxy
  • Loading branch information
simlecode authored Dec 4, 2023
2 parents 1adf038 + 08ccd75 commit bb8fe67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions proxy/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ func (p *Proxy) ProxyMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
apiHeader := r.Header.Get(VenusAPINamespaceHeader)
if apiHeader == "" {
log.Debugf("no api header found, skip proxy")
next.ServeHTTP(w, r)
return
}

ser, err := p.getReverseHandler(apiHeader)
if err != nil {
log.Errorf("get reverse handler fail: %s", err)
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
Expand All @@ -73,6 +75,7 @@ func (p *Proxy) RegisterReverseHandler(hostKey HostKey, server http.Handler) {
log.Info("unregister reverse proxy for ", hostKey)
return
}
log.Infof("register reverse proxy for %s", hostKey)
p.handler[hostKey] = server
}

Expand Down

0 comments on commit bb8fe67

Please sign in to comment.