I have a before_request function which I'd like to be actually run before every request. It sets some variables on g based on things like headers that I would like a custom error handler to be able to access. If I e.g. abort(404) from one of my own views, I'm fine, but if a request comes in that werkzeug can determine has no matching route, it bypasses my before_request function and goes straight to the error handler, so g is missing info.
I cannot reproduce that. Do you have a testcase?
D'oh, problem was on my end. Sorry for the noise.