July 13, 2017

Outlook Autodiscover.xml redirect/rewrite on nginx

By Geekphreek

I don’t know about you but I’m not a fan of lots of shite in my logs that I don’t want or need. The company email server sits at email.company.com and for some reason Outlook, even though it has correctly set DNS records as a CNAME, SRV and A record, still insists on try company.com/Autodiscover/Autodiscover.xml first.

To combat this, put this line in to your site-enabled/sitename file in the server block:

rewrite ^(/Autodiscover/Autodiscover.xml) https://autodiscover.company.com/Autodiscover/Autodiscover.xml permanent;

Obviously change out “company.com” for your valid domain name. Bye bye to a billion 404 errors thanks to M$.