Update before_request handler