Content-Length in HEAD requests through workers



I think I’m seeing an issue with workers when handling HEAD requests. According to RFC the Content-Length header should be the the same as when doing a GET request. My backend server sends the correct Content-Length but when the request goes through a worker then Content-Length is always 0.
This seems to happen with even a minimal handler like this:

addEventListener('fetch', event => {
async function handle(event) {
  return await fetch(event.request)

Worth noting that when the request bypasses workers but still goes via CloudFlare then Content-Length is correct.

Is this expected behaviour in workers?



Hi @dev8,

This is a bug! Here’s the fix:

If nothing goes wrong, it should roll out by the end of this week. Thanks for reporting this!


Great news! Thank you for the fast response!


This should now be fixed globally!