Add scotty-specific middlewares

Based on patch of Zhang Yichao <echaozh@gmail.com>