Fix middleware

Get middleware working with https://github.com/owncloud/core/pull/8265