Authorization fails for nginx with server block redirecting non-www to www

Thanks! That fixed that issue, but only for IPv4. For IPv6, it still will not work. In fact, when trying to diagnose the issue using curl, I found that it returned the actual webpage that the redirect would point to had nothing followed the domain name result of the redirection, not even the 301 redirect. Any ideas for how to fix this?