Grafana plugin data proxy is double encoding URL's

Hi there,

When routing my plugin’s HTTP’s requests through the data proxy, the request path is being double encoded. I confirmed this looking at the following logs:

nortech-cloud-datasource  | logger=data-proxy-log t=2024-12-17T15:05:42.155837169Z level=info msg="Proxying incoming request" userid=0 orgid=1 username= datasource=nortech-cloud-datasource uri=/api/datasources/proxy/uid/P56681010B853E1AB/api/v1/workspaces/Our%20devices method=GET panelPluginId= body=

nortech-cloud-datasource  | logger=data-proxy-log t=2024-12-17T15:05:42.156249211Z level=debug msg=Requesting url=http://localhost:2022/api/v1/workspaces/Our%2520devices

In the frontend I’m calling a URL ending with “/Our devices”, which is expectedly converted to “/Our%20devices”. However the Grafana backend is encoding it again, which changes the path to “/Our%2520devices” which is not an expected value by our API. Is this expected behaviour? Is there a way to avoid the second encoding?

Thanks for the help!

Hi @pedro19f1 I checked the backend code that handles the urls sent to the data proxy and we are not doing any encoding of the url (at least not that I can see. maybe I missed it)

My advice is, double check what you are sending, try for example to encode the url parameters in the frontend instead of letting the browser encoding them for you.

If ultimately you can’t find a way to make your case work and you are convinced this might be an error in Grafana please open an issue reporting a bug but be sure to provide us with a code repository we can easily clone and replicate the issue so we can fix this problem faster.

Hi @academo I’ve tried encoding the URL in the frontend myself but I got the same result.

Given the logs that I included in the first message, I would still say its an issue in the backend. I’ll open an issue.

Thanks again for the help!