Never mind... most of the times, right after you post something to a forum, you will find the answer all of a sudden..
but, to be polite, I will also include the solution (if a better one exists, please correct me)
server {
server_name ~^(?<sub>mailserver|mail|connect|autodiscover|webmail)\.mydomainname\.com$;
rewrite ^ https://$sub.mydomainname.com$request_uri? permanent;
}
The ?<sub> part wil catch the requested subdomain in the list and put it in the $sub variable. Then use this to make the redirect... A couple of hours lost with this one....
but, to be polite, I will also include the solution (if a better one exists, please correct me)
server {
server_name ~^(?<sub>mailserver|mail|connect|autodiscover|webmail)\.mydomainname\.com$;
rewrite ^ https://$sub.mydomainname.com$request_uri? permanent;
}
The ?<sub> part wil catch the requested subdomain in the list and put it in the $sub variable. Then use this to make the redirect... A couple of hours lost with this one....