From 7dabfb6223767146a12217f83373605ecc5d12de Mon Sep 17 00:00:00 2001 From: Roman Priesol Date: Fri, 30 Oct 2026 13:56:55 +0100 Subject: [PATCH] Brother proxy: rewind request body before forwarding (Rack 3 leaves it consumed) --- app.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app.rb b/app.rb index 7db6ade..fc9f37b 100644 --- a/app.rb +++ b/app.rb @@ -241,7 +241,12 @@ helpers do proxied['Content-Type'] = request.content_type if request.content_type proxied['X-Forwarded-Prefix'] = prefix proxied['X-Forwarded-Host'] = request.host - proxied.body = request.body.read unless request.request_method == 'GET' + # Sinatra already consumed the body when parsing params (Rack 3 no longer + # rewinds it), so rewind first or form POSTs reach brother_ql_web empty. + unless request.request_method == 'GET' + request.body.rewind + proxied.body = request.body.read + end res = Net::HTTP.start(uri.host, uri.port) { |http| http.request(proxied) }