Hey everyone,
we are having the following problem:
We are trying to proxy a datasource request through grafana backend as described in
Add authentication for data source plugins | Grafana documentation . But unfortunately calling
const routePath = '/example';
getBackendSrv()
.datasourceRequest({
url: this.url + routePath + '/foo/bar',
method: 'GET',
});
does not make a request to https://api.example.com/foo/bar but to
api/datasources/proxy/7/example/foo/bar, which obviously creates a 502 error, since this is not a valid URL
From our understanding the routePath = “example” command should read the route “example” defined in plugin.json but that does not work.
Plugin.json:
t=2021-08-23T14:10:50+0000 lvl=info msg="Proxying incoming request" logger=data-proxy-log userid=2 orgid=1 username=XX.YY@domain.com datasource=
en-auth
uri=/grafana/api/datasources/proxy/7/example/foo/bar method=GET body=
According to the upper grafana logs, the request is proxied to the backend, so i think we are missing some configuration that fetches the correct route from plugin.json to proxy the request.
Unfortunately the grafana documentation does not give more information on this.
Does anyone have an idea how to proceed here?
Thanks in advance