A here-document is not a here-string, and the quoting differs

A heredoc expands variables and command substitutions by default, which is convenient for a template and disastrous for anything containing a dollar sign that belongs to another language.

# expands $HOME, $(date), backticks — usually what you want
cat > /etc/nginx/conf.d/site.conf <<CONF
server_name ${DOMAIN};
root /var/www/${APP}/current/public;
CONF

# quoted delimiter: NOTHING expands. for scripts and configs.
cat > /usr/local/bin/check <<'SCRIPT'
#!/usr/bin/env bash
echo "$1 and $HOME are literal here"
SCRIPT

Quoting the delimiter is the whole distinction and it is invisible in a diff — one apostrophe changes every line of the body. The failure is a generated nginx config where $uri and $query_string have been replaced with empty strings, which produces a server that starts and serves the wrong thing. <<- with a leading dash strips leading tabs only, not spaces, which is why indented heredocs so often do not work as expected.