Fix domain middleware redirects.
Merge branch 'fix/redirect-domain-middleware'