diff --git a/main.go b/main.go index f1fddf68cab202a8eea5fdfd6c807e977467b312..fa40123a6cd50b778588235804656327f4b620cd 100644 --- a/main.go +++ b/main.go @@ -56,8 +56,20 @@ func main() { if err != nil { fmt.Println(err) } + // Define the host + host := "https://" + r.Host + fmt.Println(host) + // Get the response body as a string + pageContentString := string(contents) + // Replace redirectUri by the host in the body + pageContentString = strings.ReplaceAll(pageContentString, redirectUri, host) + fmt.Println(pageContentString) + // Convert string to byte for response writting + newPageContentByte := []byte(pageContentString) + + // fmt.Println(r.Host) if response.StatusCode >= 200 && response.StatusCode <= 299 { - w.Write(contents) + w.Write(newPageContentByte) } else { http.Error(w, http.StatusText(response.StatusCode), response.StatusCode) }