Skip to content

Datasource not working when Grafana is configured with root_url #9

@fetzerch

Description

@fetzerch

The datasource doesn't show any values if Grafana is configured to run on a different root_url.

The error log shows that the directory from the root_url setting is not passed to the request:

GET http://server/api/datasources/proxy/7/v1/tasks/8232611d-27f5-4716-9a83-28ae867ffdc1/watch 404 (Not Found)

While the correct URL would be:

http://server/grafana/api/datasources/proxy/7/v1/tasks/8232611d-27f5-4716-9a83-28ae867ffdc1/watch

The issue seems to be in this function: https://github.com/raintank/snap-app/blob/master/src/datasource/stream_handler.js#L31 (this.ds.url does not contain the configured subdirectory).

In Grafana core this is usually implemented by importing app/core/config and prepending config.appSubUrl to the URLs. I'm not sure if that's a working / acceptable solution also for a plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions