I would like to add another important point not mentioned in the accepted answer.
$host do NOT have port number, while $http_host DO include the port number.
edit: not always.
I set up a header “add_header Y-blog-http_host “$http_host” always;”
Then curl -I -L domain.com:80 …