Skip to content

[BUG] Node Graph API is not using getBackendSrv/Proxy resulting access issues and CORS issues #12

Closed
@jtorkkel

Description

@jtorkkel

Describe the bug
Node Graph plugin is not using Grafana recommended getBackendSrv/proxy . This result that all queries done by plugin are actually originating from the machine running the Browser. For example calling localhost calls the calling machine localhost, not localhost in machine where Grafana is running.

This leads to

  • access issues if URL the plugin is accessing is whitelisted, for example VPN access
  • CORS issues, Need to have CORS headers in response, Browser still might block quests

Expected behavior
Using getBackendSrv which proxy request through grafana server.

Extract from https://grafana.com/tutorials/build-a-data-source-plugin/
While you can use something like axios or the Fetch API to make requests, we recommend using the getBackendSrv function from the grafana/runtime package.

The main advantage of getBackendSrv is that it proxies requests through the Grafana server rather making the request from the browser. This is strongly recommended when making authenticated requests to an external API. For more information on authenticating external requests, refer to Add authentication for data source plugins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions