Add support for middlewares with hyphens

Change-Id: I1142270f76285190b600da759753011331a85909
Closes-bug: #1278950
(cherry picked from commit af45e4200ecc26fc34df2f785b79eb89426bd69b)