Skip to content

Commit

Permalink
fix: rewrite content-length header when returning decompressed body
Browse files Browse the repository at this point in the history
  • Loading branch information
stanxing authored and oiooj committed Apr 15, 2021
1 parent 258f7b0 commit 236ffb4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions proxy/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ func (router *Router) customModResponse(r *http.Response) error {
return err
}
r.Header.Del("Content-Encoding")
// rewrite content-length header due to the decompressed data will be refilled in the body
r.Header.Set("Content-Length", fmt.Sprint(len(buf)))
} else {
buf, err = ioutil.ReadAll(r.Body)
if err != nil {
Expand Down

0 comments on commit 236ffb4

Please sign in to comment.