code: func (t *Transport) rewriteResponse(req *http.Request, resp *http.Response) (*http.Response, error) {
  	origBody := resp.Body
  	defer origBody.Close()
  
  	newContent := &bytes.Buffer{}
  	var reader io.Reader = origBody
  	var writer io.Writer = newContent
  	encoding := resp.Header.Get("Content-Encoding")
  	switch encoding {
  	case "gzip":
  		var err error
  		reader, err = gzip.NewReader(reader)
  		if err != nil {
  			return nil, fmt.Errorf("errorf making gzip reader: %v", err)
  		}
  		gzw := gzip.NewWriter(writer)
  		defer gzw.Close()
  		writer = gzw
  	// TODO: support flate, other encodings.
  	case "":
  		// This is fine
  	default:
  		// Some encoding we don't understand-- don't try to parse this
  		glog.Errorf("Proxy encountered encoding %v for text/html; can't understand this so not fixing links.", encoding)
  		return resp, nil
  	}
  
  	urlRewriter := func(targetUrl string) string {
  		return t.rewriteURL(targetUrl, req.URL)
  	}
  	err := rewriteHTML(reader, writer, urlRewriter)
  	if err != nil {
  		glog.Errorf("Failed to rewrite URLs: %v", err)
  		return resp, err
  	}
  
  	resp.Body = ioutil.NopCloser(newContent)
  	// Update header node with new content-length
  	// TODO: Remove any hash/signature headers here?
  	resp.Header.Del("Content-Length")
  	resp.ContentLength = int64(newContent.Len())
  
  	return resp, err
  }
docs: // rewriteResponse modifies an HTML response by updating absolute links referring
  // to the original host to instead refer to the proxy transport.