Docker Grafana reverse proxy (nginx) Cloudflare Domain

So i am having issue with grafana and reverse proxy (nginx)
Its giving Error 521 Webserver is down on cloudflare domain
My Nginx.conf is

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;
#    include    /etc/nginx/conf.d/*.conf;


  server { 
    listen          443 ssl;
    server_name     www.mydomain.net;
#    access_log      logs/file.acees.log main;
    ssl_certificate /etc/nginx/certs/domain.net.pem;
    ssl_certificate_key /etc/nginx/certs/domain.net.key;
    proxy_set_header X-Forwarded-Proto https;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  Host $host;
    proxy_set_header  X-Url-Scheme $scheme;
    proxy_redirect    off;
    proxy_max_temp_file_size 0;

    location / {
      add_header Content-Security-Policy "script-src: 'unsafe-eval' 'unsafe-inline';";
      proxy_pass     http://<ip>:3000/;
    }
  }
}

My Grafana.ini is

;protocol = http

;http_addr =

# The http port  to use
;http_port = 3000

# The public facing domain name used to access grafana from a browser
;domain = www.mydomain.net


;enforce_domain = false

;root_url = %(protocol)s://%(domain)s:%(http_port)s/grafana/

;serve_from_sub_path = false

The grafana login page is accessible throught ip:3000 but the domain gives nothing but an error 521.
Any help will be much appreciated

So i fixed the issue
I was using NGINX docker image for reverse proxy and there seems to be some issue
Installed the NGINX (non docker version) added the same configuration and it works fine