Swag proxy-conf for Grafana

I have tried using the grafana proxy-conf which comes default in swag, however I get into a loop when access grafana via reverse proxy. Please could someone help

Here is my config

On Grafana, I’m using environment variable
GF_SERVER_DOMAIN = localhost
GF_SERVER_ROOT_URL = %(protocol)s://%(domain)s:%(http_port)s/grafana/

and this is my proxy-conf for Grafana

server {
listen 443 ssl;
listen [::]:443 ssl;

server_name grafana.*;

include /config/nginx/ssl.conf;

client_max_body_size 0;

# enable for ldap auth, fill in ldap details in ldap.conf
#include /config/nginx/ldap.conf;

# enable for Authelia
#include /config/nginx/authelia-server.conf;

location / {
    # enable the next two lines for http auth
    #auth_basic "Restricted";
    #auth_basic_user_file /config/nginx/.htpasswd;

    # enable the next two lines for ldap auth
    #auth_request /auth;
    #error_page 401 =200 /ldaplogin;

    # enable for Authelia
    #include /config/nginx/authelia-location.conf;

    #include /config/nginx/proxy.conf;
    #include /config/nginx/resolver.conf;
    set $upstream_app;
    set $upstream_port 3000;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port/grafana;
    # Clear Authorization Header if you are using http auth and normal Grafana auth
    proxy_set_header    Authorization       "";        



When I try accessing grafana.xxxx.co.in it goes into a loop with this in the address bar https://grafana.xxxx.co.in/?chunkNotFound and a details error message

I tries replacing localhost in grafana domain variable and conf file but gives a 502 gateway error. Any help is really appreciated