I have the following nginx config:
location /mail { rewrite ^/mail/(.*) /$1 break; proxy_pass https://roundcube-host;
If I change it to the below with the extra / it matches everything beyond mail as well as /mail directly.
location /mail/ { }
NGINX 1.14.2