bug fix for domain name matching in middleware