Skip to content
Snippets Groups Projects
Commit a41b65e9 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

Test with replacing redirect in html body by host

parent 9cbff30c
Branches
No related tags found
No related merge requests found
Pipeline #5367 passed
......@@ -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)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment