fix search in locations, fix proxying URI in http

This commit is contained in:
Maxim Merzhanov committed 2020-04-24 19:12:31 +03:00
1 parent f0b8407479
commit 896dd36025
7 files changed
+126 -82

No files matched your search

+4 -3
View File
@@ -2,6 +2,9 @@ package http
import (
"errors"
"net"
"strings"
"github.com/integration-system/isp-lib/v2/structure"
log "github.com/integration-system/isp-log"
"github.com/valyala/fasthttp"
@@ -9,8 +12,6 @@ import (
"isp-gate-service/domain"
"isp-gate-service/log_code"
"isp-gate-service/utils"
"net"
"strings"
)
type httpProxy struct {
@@ -53,7 +54,7 @@ func (p *httpProxy) ProxyRequest(ctx *fasthttp.RequestCtx, path string) domain.P
req := &ctx.Request
res := &ctx.Response
req.SetRequestURI(path)
req.URI().SetPath("/" + path)
if addr, _, err := net.SplitHostPort(ctx.RemoteAddr().String()); err == nil {
req.Header.Add("X-Forwarded-For", addr)