middlewares of main namespace should be called first
Merge pull request #1403 from nkzawa/patch-1

middlewares of main namespace should be called first