mirror of
https://github.com/labstack/echo.git
synced 2025-01-12 01:22:21 +02:00
Proxy rename descr to desc
Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
parent
bc37a3a792
commit
ac1f40118a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user