coupergateway / couper

Couper is a lightweight API gateway designed to support developers in building and operating API-driven Web projects
https://couper.io
MIT License
85 stars 15 forks source link

Streaming a backend response-body seems to be broken with `proxy`. #766

Closed malud closed 9 months ago

malud commented 1 year ago

Describe the bug

While Couper tries to detect the usage of body or json_body variable references to decide to read the upstream response body or not the condition for that seems to be broken since Couper will buffer the content even those variables are not in use.

To Reproduce Steps to reproduce the behavior:

  1. Which Couper version? Run couper version or docker run avenga/couper version

edge and 1.12

  1. Provide your configuration file *.hcl. Remove sensitive data.
server {
  endpoint "/" {
    proxy {
      url = "http://cdimage.ubuntu.com/releases/22.04/release/ubuntu-22.04.3-live-server-arm64.iso"
    }
  }
}
  1. Provide a curl call for reproduction

curl -v http://localhost:8080/

Expecting to see data chunks while streaming the iso file but it all gets loaded into memory if you closely watch the Couper process allocs.