Skip to content

Commit

Permalink
Proxy rename descr to desc
Browse files Browse the repository at this point in the history
Signed-off-by: Vishal Rana <[email protected]>
  • Loading branch information
vishr committed Oct 13, 2018
1 parent bc37a3a commit ac1f401
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions middleware/proxy_1_11.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ package middleware

import (
"fmt"
"github.com/labstack/echo"
"net/http"
"net/http/httputil"

"github.com/labstack/echo"
)

func proxyHTTP(tgt *ProxyTarget, c echo.Context, config ProxyConfig) http.Handler {
proxy := httputil.NewSingleHostReverseProxy(tgt.URL)
proxy.ErrorHandler = func(resp http.ResponseWriter, req *http.Request, err error) {
descr := tgt.URL.String()
desc := tgt.URL.String()
if tgt.Name != "" {
descr = fmt.Sprintf("%s(%s)", tgt.Name, tgt.URL.String())
desc = fmt.Sprintf("%s(%s)", tgt.Name, tgt.URL.String())
}
c.Logger().Errorf("remote %s unreachable, could not forward: %v", descr, err)
c.Logger().Errorf("remote %s unreachable, could not forward: %v", desc, err)
c.Error(echo.ErrServiceUnavailable)
}
proxy.Transport = config.Transport
Expand Down

0 comments on commit ac1f401

Please sign in to comment.