kataras / kataras/iris

[BUG]AccessLog.ResponseBody affects the result of the httputil.ReverseProxy

Open
#1,740 0 comments 0 reactions 1 assignee Claimed by @kataras View on GitHub
🐞 type:bug
Dominant language
Go
Stars
25.6k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

code snippet:
```go
app := iris.New()

ac := accesslog.File("./access.log")
ac.TimeFormat = "2006-01-02 15:04:05.000"
ac.Async = true
ac.ResponseBody = true
app.UseRouter(ac.Handler)

app.Get("/proxy/{p:path}", func(ctx iris.Context) {
targetPath := ctx.Params().Get("p")
u, _ := url.Parse("http://t0.tianditu.gov.cn/" + targetPath)
proxy := host.ProxyHandlerRemote(u, true)
proxy.ServeHTTP(ctx.ResponseWriter(), ctx.Request())
})

app.Listen(":8080")
```

if `ac.ResponseBody` set to true, I will get a blank page when request to /proxy/*

request url:
http://localhost:8080/proxy/img_c/wmts?tk=17a1ad415ea7cd473fb96098836c8a61&REQUEST=GetCapabilities&SERVICE=WMTS

target url:
http://t0.tianditu.gov.cn/img_c/wmts?tk=17a1ad415ea7cd473fb96098836c8a61&REQUEST=GetCapabilities&SERVICE=WMTS

expected:
![image](https://user-images.githubusercontent.com/26807520/110575842-933b0f00-819a-11eb-85f8-fd27ae6f2a77.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.