Skip to content

Commit b73ee1d

Browse files
authored
Fix infinite redirect issue (#612)
1 parent 5191771 commit b73ee1d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

examples/redirect-https/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ func main() {
1616
proxy := goproxy.NewProxyHttpServer()
1717
proxy.OnRequest().HandleConnect(goproxy.AlwaysMitm)
1818
proxy.OnRequest().DoFunc(func(req *http.Request, ctx *goproxy.ProxyCtx) (*http.Request, *http.Response) {
19-
if req.URL.Scheme == "https" {
20-
req.URL.Scheme = "http"
19+
if req.URL.Scheme != "https" {
20+
return req, nil
2121
}
2222

23+
req.URL.Scheme = "http"
2324
resp := &http.Response{
2425
StatusCode: http.StatusSeeOther,
2526
ProtoMajor: 1,

0 commit comments

Comments
 (0)