Решение: map "$http_via" $noCDN { default 1; "~.*\.edge\.worldcdn\.net" 0; } server { listen 0.0.0.0:80; server_name example.com; if ($noCDN) { return 301 $scheme://www.example.com$request_uri; } } Posted at Nginx Forum: https://forum.nginx.org/read.php?21,263615,263622#msg-263622