From 898ca97c822fd1e4a00ccfe8948f35f6ce144261 Mon Sep 17 00:00:00 2001 From: Achmad Irianto Eka Putra Date: Mon, 25 Sep 2023 01:35:20 +0700 Subject: [PATCH] fix: close connection when running in mobile wifi proxy --- webproxy/webproxy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webproxy/webproxy.go b/webproxy/webproxy.go index c17f5cc..0637b30 100644 --- a/webproxy/webproxy.go +++ b/webproxy/webproxy.go @@ -1,6 +1,7 @@ package webproxy import ( + "fmt" "github.com/gofiber/fiber/v2" "github.com/valyala/fasthttp" "io" @@ -60,8 +61,9 @@ func (s *WebProxy) handleHTTP(c *fiber.Ctx) error { // handleTunneling handles CONNECT requests func (s *WebProxy) handleTunneling(c *fiber.Ctx) error { - destConn, err := fasthttp.DialTimeout(c.Hostname(), s.TunnelTimeout) + destConn, err := fasthttp.DialTimeout(c.OriginalURL(), s.TunnelTimeout) if err != nil { + fmt.Println(err) return c.Status(fiber.StatusServiceUnavailable).SendString(err.Error()) }