Some middleware needs to be added at the end of the list (since it relies on stuff added by the session/locale/common/csrf/etc middleware). Could this be flipped, so it adds the local_settings ones on to the end?