Content-Length: 0 for 304 responses with empty body
Author: EmilioCristalliCreated Aug 10, 2026Updated Aug 10, 2026
Describe the bug
We are seeing 304 response with empty body and content-length: 0. Not sure if this is expected, or a bug.
Our clients are not handling it well (probably because of a bug on our side), but looking at the HTTP specs it looks like the server should not send the header (or send the the content-length for the original response)? not sure if i'm reading it correctly or if this is the latest spec, though.
Puma config:
# puma.rb
port 3000
threads 3, 5To Reproduce
# hello.ru
run lambda { |env| [304, {"Content-Type" => "text/plain"}, []] }Run it with:
bundle exec puma -C puma.rb hello.ruExpected behavior
Was expecting that doing curl -s -D - 'http://localhost:3000' would return no content-length header
Desktop (please complete the following information):
- OS: Mac
- Puma Version: 8.0.2
- Ruby Version: 3.4.8
Source: puma/puma