Nginx returns 499 on /

I鈥檝e set up Nextcloud with docker using the 23.0.0-fpm-alpine image, and I鈥檓 running nginx with nginx:stable-alpine. Nextcloud is up and running, but I have Consul health checking the nginx container and failing because nginx returns error 499 on the / path.

I鈥檓 running nginx with the example config found here: docker/nginx.conf at master 路 nextcloud/docker 路 GitHub

I鈥檓 not running docker-compose but the setup is the same, nextcloud and nginx both mount the same /var/www/html folder, nginx as read-only.

The only thing I changed in the config is this part:

    upstream php-handler {
        server {{ env "NOMAD_ADDR_fpm" }};
    }

The template resolves to 192.168.1.100:9000 which is the nextcloud listener, and I verified with nc -zv 192.168.1.100 9000 that it is indeed open and listening.

An example log line from nginx when requesting /:

192.168.1.100 - - [30/Jan/2022:12:47:35 +0000] "GET / HTTP/1.1" 499 0 "-" "Consul Health Check" "-"

What could be causing nginx to return error 499?