Maintain ordering with path->middleware mapping.

The previous path->middleware mapping solution didn't
explicitly order the sequence in which middlewares would
be applied. This updates the configuration to do that.