Redirecting Drupal multisite non-www to www with varnish / nginx I'm building Drupal multisite with 35 sites (~60 different domains) and I'd like to redirect non-www urls to www regardless of domain.

Nginx is redirecting all domains to Drupal install folder.

I've tried to redirect domains with Nginx without success (is that even possible because of varnish?)

I was able to redirect single domain with Varnish (something like "if domain == xxx then redirect to www.domain.tld"), but I don't want to make own redirect rule for every domain.
I was able to do it with the following nginx config:

if ($host !~* ^www\.) {
   rewrite ^(.*)$ http://www.$host$1 permanent;
}