Fix naked domain issue with middleware