domain correction middleware