Handle 500/404, empty Content-Length and requestMaxSize with JSON error messages.