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

We should remove the `next` as we don't use it in the view.