Render 404 and 500 response before is returned.