code: func (fp *ForwardProxy) generateForwardRequest(inReq *http.Request) (*http.Request, error) {
  	// Scheme has to be appended to avoid `unsupported protocol scheme ""` error.
  	// `http://` is used, since this initial request itself is always HTTP, regardless of what client and server
  	// may speak afterwards.
  	if len(inReq.RequestURI) == 0 {
  		return nil, errors.New("malformed request: empty URI")
  	}
  	strUrl := inReq.RequestURI
  	if strUrl[0] == '/' {
  		strUrl = inReq.Host + strUrl
  	}
  	if !strings.Contains(strUrl, "://") {
  		strUrl = "http://" + strUrl
  	}
  	outReq, err := http.NewRequest(inReq.Method, strUrl, inReq.Body)
  	if err != nil {
  		return outReq, errors.New("failed to create NewRequest: " + err.Error())
  	}
  	for key, values := range inReq.Header {
  		for _, value := range values {
  			outReq.Header.Add(key, value)
  		}
  	}
  	removeHopByHop(outReq.Header)
  
  	if !fp.hideIP {
  		outReq.Header.Add("Forwarded", "for=\""+inReq.RemoteAddr+"\"")
  	}
  
  	// https://tools.ietf.org/html/rfc7230#section-5.7.1
  	outReq.Header.Add("Via", strconv.Itoa(inReq.ProtoMajor)+"."+strconv.Itoa(inReq.ProtoMinor)+" caddy")
  	return outReq, nil
  }
docs: // Based on http Request from client, generates new request to be forwarded to target server.
  // Some fields are shallow-copied, thus genOutReq will mutate original request.
  // If error is not nil - http.StatusBadRequest is to be sent to client.