Unable to host Grafana behind Nginx when using internal Datasource APIs in custom plugin

Hi, I had hosted the Grafana app behind the nginx with simple configuration and it worked.
However, later I added my custom panel plugin which is using Grafana datasource APIs. Now if I try to access grafana plugin from nginx I get below error:

Access to fetch at http://localhost:3000/api/datasources/name/Prometheus from origin ‘http://nginx_ip_here’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

After some google search, I put CORS header inside nginx/sites-enabled/default configuration file but I keep getting the same results. I’ve almost tried all the solutions from the internet but nothing has worked. Now I am wondering, do I also need to update some internal config file from Grafana in order to get rid of this error?
I would really appreciate your help.