🐛 Bug fixes infinite redirecting
Some checks are pending
release-nightly / build-docker (push) Waiting to run

This commit is contained in:
2024-01-26 16:04:34 +08:00
parent 302491741f
commit 2860542e44
3 changed files with 17 additions and 16 deletions

View File

@ -9,7 +9,6 @@ import (
"github.com/gofiber/fiber/v2/utils"
"github.com/rs/zerolog/log"
"github.com/samber/lo"
"github.com/spf13/viper"
"github.com/valyala/fasthttp"
"io/fs"
"net/http"
@ -32,10 +31,11 @@ func makeUnifiedResponse(c *fiber.Ctx, dest *Destination) error {
}
func makeHypertextResponse(c *fiber.Ctx, dest *Destination) error {
timeout := time.Duration(viper.GetInt64("performance.network_timeout")) * time.Millisecond
return proxy.Do(c, dest.MakeUri(c), &fasthttp.Client{
ReadTimeout: timeout,
WriteTimeout: timeout,
limit := 60 * time.Millisecond
uri := dest.MakeUri(c)
return proxy.Do(c, uri, &fasthttp.Client{
ReadTimeout: limit,
WriteTimeout: limit,
})
}

View File

@ -75,9 +75,10 @@ func (v *Destination) MakeUri(ctx *fiber.Ctx) string {
path := string(ctx.Request().URI().Path())
hash := string(ctx.Request().URI().Hash())
protocol := v.GetProtocol()
uri, _ := v.GetRawUri()
return uri + path +
return protocol + "://" + uri + path +
lo.Ternary(len(queries) > 0, "?"+strings.Join(queries, "&"), "") +
lo.Ternary(len(hash) > 0, "#"+hash, "")
}