middleware config callbacks