Question about forcing HTTPS traffic with Grafana

I added the certificate and the server only returns “Client sent an HTTP request to an HTTPS server.” errors.
Everything works if I add an s to the http of the proxy_pass http://127.0.0.1:3000.
Everything also works if I replace the http with the $scheme variable to keep the protocol used by the client.

    # Grafana
    rewrite ^/$ $scheme://$http_host/graph/;
    rewrite ^/graph$ /graph/;
    location /graph {
      proxy_cookie_path / "/;";
      proxy_pass http://127.0.0.1:3000; # <== Works with an `s` here, or with `$scheme` instead of `http`
      rewrite ^/graph/(.*) /$1 break;
      proxy_read_timeout 600;
    }

The problem is that this configuration (it’s a Percona PMM server) is outside the configuration volumes.