I’m trying to develop a custom plugin which can request a resource in the web (based on configuration). I’ve found this url mentioning Grafana proxy: Access data source from an app type plugin page
My understanding of it is I can use build-in proxy to make such a call, e.g.
new-dashboard-copy?orgId=1:1 Access to fetch at 'https://google.com/' from origin 'http://grafana.staged-by-discourse.com' has been blocked by CORS policy: 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.
Am I missing something here? What do I need to do to achieve this?
Hey there, I think you need to reach out to the team that build the backend API that you wanted to fetch the API using getBackendSrv method. The team need to set the http header Access-Control-Allow-Origin to true. This, in my opinion, is the backend issue. Hope this helps.
@nicolasdossantos248 these headers won’t heave effect in the request side. The headers you are trying to use here should be the ones returning in the API side.
Hi @nicolasdossantos248 I really can’t help you with the setup in your API side. The headers look correct to me. Verify using the browser devtools that the request from grafana to the API is receiving the headers you are sending.