From 36eab35576f616018e5da04d8197c73741706cea Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Sat, 30 May 2026 19:24:40 +0200 Subject: [PATCH] feat: add "Host" header Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- internal/intercept/format.go | 3 +++ internal/ui/intercept/helpers.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/internal/intercept/format.go b/internal/intercept/format.go index 68cc8d9..c6a0cbb 100644 --- a/internal/intercept/format.go +++ b/internal/intercept/format.go @@ -14,6 +14,9 @@ func FormatRawRequest(f *proxy.Flow) string { r := f.Request var sb strings.Builder fmt.Fprintf(&sb, "%s %s %s\n", r.Method, r.URL.RequestURI(), r.Proto) + if r.URL.Host != "" { + fmt.Fprintf(&sb, "Host: %s\n", r.URL.Host) + } for _, line := range util.SortedHeaderLines(r.Header) { sb.WriteString(line) } diff --git a/internal/ui/intercept/helpers.go b/internal/ui/intercept/helpers.go index 7441762..9212f2e 100644 --- a/internal/ui/intercept/helpers.go +++ b/internal/ui/intercept/helpers.go @@ -28,8 +28,14 @@ func parseRawRequest(content string, req *intercept.PendingRequest) { if parsed.Proto != "" { r.Proto = parsed.Proto } + if parsed.Host != "" { + r.URL.Host = parsed.Host + } r.Header = make(http.Header) for _, h := range parsed.Headers { + if strings.EqualFold(h.Key, "host") { + continue + } r.Header.Set(h.Key, h.Value) } if parsed.Body != "" {