updated sudomain middleware