Add flag to make middleware overriding optional