Due to a bug in rewrite.py, certain 404s sent by ms-fe hosts are returned with Content-Length: 69 while the actual content length is 9, len("Not Found").
For example:
$ curl -v https://swift-rw.discovery.wmnet/wikipedia/commons/thumb/6/60/K < HTTP/1.1 404 Not Found [...] < Content-Type: text/html; charset=UTF-8 < Content-Length: 69 [...] curl: (18) transfer closed with 60 bytes remaining to read Not Found
This causes various issues at the CDN layer resulting in 503 errors.
It seems that the problem is at line 94:
return swob.HTTPException(status=status, body=error.msg, headers=error.hdrs.items())
The body is set to the error message (probably the string "Not Found"?), while the list of headers, including Content-Length, is passed as-is from Thumbor. Indeed, 69 is the length of the Thumbor response:
$ curl -v http://thumbor.svc.eqiad.wmnet:8800/wikipedia/commons/thumb/6/60/K < HTTP/1.1 404 Not Found [...] < Content-Length: 69 [...] <html><title>404: Not Found</title><body>404: Not Found</body></html>