RedirectMatch rule prevents mail autoconfig

using Debian 10 buster - but should not matter.

When you create a Website redirect, ".well-known" is correctly excluded in the RedirectMatch.

RedirectMatch ^/(?!.well-known)(.*)$ https://new-domain.tld

But then, mail autoconfig does not work anymore, so I'd suggest to do something like this:

RedirectMatch ^/(?!.well-known|mail/config-v1.1.xml|cgi-bin/autoconfig.cgi|AutoDiscover)(.*)$ https://new-domain.tld

or may be include all such ScriptAliases, if any?

Status: 
Active

Comments

Assigned: Unassigned »

Thanks for your report! I've passed this along to Jamie for further comment.

Do you recall what error you were seeing in your email client when you don't include the fix you've provided?

And also, what email client/version are you using?

Thanks!

Also, are you creating this redirect yourself in Virtualmin, or using it's built-in support for mail autoconfig?

Hello Jamie, Joe,

thanx for your answers and sorry for my late reply, was travelling abroad at this time, so must have missed it. Now found my own issue in a similar case ... ;)

  • used the built-in support for mail autoconfig and the built-in Website redirect

  • had to do some remote support for someone using Outlook, I think we tested using this tool: https://www.priasoft.com/autodiscover-testing-tool/

  • could track the creation of this redirect down using Webmin logged actions to half a year ago, created by 'save_redirect.cgi'

  • a bash one liner to find all occurrences for domains with mail and autoconfig/redirects I use atm:

for i in `virtualmin list-domains --enabled --with-feature mail --name-only --no-alias`  ; do file=/etc/apache2/sites-available/\*$i.conf ; ls -1 $file && echo found $i ; egrep "Redirect.*(well-known|autoconfig)" $file ; echo ; done
  • if found, I replace such lines by something like "RedirectMatch ^/(?!.well-known|mail|cgi-bin|AutoDiscover)(.*)$ https://domain.tld/$1", but perhaps there are other/better exclude terms possible

Hope this helps someone.

I think it would be valueable if "virtualmin check-config" could find things like this:

  • vhosts with mail and autoconfig enabled, but missing "Redirect /.well-known/autoconfig/mail/config-v1.1.xml /cgi-bin/autoconfig.cgi"

  • vhosts with RedirectMatch and no .well-known exclude

Best regards, Falko