Proxy route with dynamic url

Hi there,

the topic of dynamic urls was already asked here and denied, but at least this test indicates that it should work (now?).

Therefore I tried following route within my plugin.json

"routes": [
    {
      "path": "dynamic",
      "method": "GET",
      "url": "{{.JsonData.url}}",
      "headers": [
          {"name": "X-Custom", "content": "{{.JsonData.header}}"}
      ]
    }
  ],

the datasource looks like this

{
  "id": 1,
  "orgId": 1,
  "name": "doit",
  "type": "my-datasource",
  "typeLogoUrl": "",
  "access": "proxy",
  "url": "",
  "password": "",
  "user": "",
  "database": "",
  "basicAuth": false,
  "basicAuthUser": "",
  "basicAuthPassword": "",
  "withCredentials": false,
  "isDefault": true,
  "jsonData": {
    "header": "custom-header-content",
    "keepCookies": [

    ],
    "url": "http://dynamic.url.local"
  },
  "secureJsonFields": {

  },
  "version": 7,
  "readOnly": false
}

The route itself is executed, but finally I end up having my url not replaced at all.
Adding the header is working as expected (and if the url is hardcoded inside the route this is running, also).

If I save & test my datasource this results in bad gateway.
See logs below:

t=2018-10-18T09:59:46+0000 lvl=info msg=Requesting logger=data-proxy-log url="%7B%7B.JsonData.url%7D%7D/api/snapshots"
t=2018-10-18T09:59:46+0000 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=GET path=/api/datasources/proxy/1/dynamic/api/snapshots status=502 remote_addr=172.0.0.1 time_ms=1 size=0 referer=http://localhost:3000/datasources/edit/1

I’m running examples on grafana version 5.2.2.

Can anyone give me a hint to get the url being replaced correctly?

Best Regards
Lars

not sure why, check DB and jsonData to make sure the provisioning worked.

Hi there, provisioning is working fine.

It seems that Route.Url is encoded before ApplyRoute() is called.

Regards
Lars

As a dynamic url is also used in Microsoft Azure Data Explorer,
I increased the required Grafana version to 5.3.x accordingly and:

Workz fine now.

Regards
Lars