Skip to content

Commit

Permalink
Fix infinite redirect issue (#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikPelli authored Jan 3, 2025
1 parent 5191771 commit b73ee1d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/redirect-https/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ func main() {
proxy := goproxy.NewProxyHttpServer()
proxy.OnRequest().HandleConnect(goproxy.AlwaysMitm)
proxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
if req.URL.Scheme == "https" {
req.URL.Scheme = "http"
if req.URL.Scheme != "https" {
return req, nil
}

req.URL.Scheme = "http"
resp := &http.Response{
StatusCode: http.StatusSeeOther,
ProtoMajor: 1,
Expand Down

0 comments on commit b73ee1d

Please sign in to comment.