rstudio / shinyloadtest

Tools for load testing Shiny applications
https://rstudio.github.io/shinyloadtest
108 stars 22 forks source link

Reverse proxy retains outer Content-Length when chunking request body #154

Open mbaynton opened 2 years ago

mbaynton commented 2 years ago

I'm encountering some trouble making a recording of the Utah Lake Water Quality Profile Dashboard from the shiny app gallery. It looks like probably all POST requests proxied through shinyloadtest return a 413 to the browser. This happens with requests whose Content-Length is less than 2kb, at least.

I'm using connect as the backend server, and if I observe traffic between shinyloadtest and connect I see that the request is forwarded on, but transformed to send the body with chunked Transfer-Encoding. I strongly suspect the issue is that the browser, which just sent the request body directly with no chunking, included a Content-Length header, and that header is carried forward after the chunking is performed by the proxy. I believe technically the Content-Length and Transfer-Encoding: chunked headers are mutually exclusive, and this is probably confusing connect or httpuv.

mbaynton commented 2 years ago

Hmm, I recorded the HTTP request + body between shinyloadtest and connect to a file, hex-edited out the Content-Length header, and played the file back to connect, but it still results in a 413. So this must be more complex than just stripping the Content-Length header if we perform chunked transfer-encoding.

Is there a way to just disable this transformation of the request body to be sent this way?