Added in badger middleware for SDEV-453

This pull request goes together with a pull request in badger for SDEV-453.