Refactor http headers: allow to set custom headers for errors