# Using Grafana's API though kubernetes proxy

**URL:** <https://community.grafana.com/t/using-grafanas-api-though-kubernetes-proxy/20644>\
**Category:** Grafana\
**Created:** [September 2, 2019, 2:42pm UTC](https://community.grafana.com/t/using-grafanas-api-though-kubernetes-proxy/20644 "2019-09-02T14:42:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dangolding](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@dangolding](https://community.grafana.com/u/dangolding)\
**Post date:** [September 2, 2019, 2:42pm UTC](https://community.grafana.com/t/using-grafanas-api-though-kubernetes-proxy/20644/1 "2019-09-02T14:42:47Z")

</div>

I am running Grafana v6.2.4 in kubernetes. I want to use the k8s proxy for testing. I have changed the `GF_SERVER_ROOT_URL` environment variable to `"http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/"`. This allows me to use Grafana through my browser at `http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/`. However, I want to use it via the API. If I send a request to `http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/api/dashboards/db` I get back the message “Unauthorized”. However, if I set up a kubernetes port foward and send the identical request to `http://localhost:30099/api/dashboards/db`, then it succeeds. Is there a difference environment variable aside from `GF_SERVER_ROOT_URL` that I should be changing so that the API server root goes through the k8s proxy, i.e. `http://localhost:8080/api/v1/namespaces/my-namespace/services/grafana-prom:80/proxy/api/dashboards/db` ?

---

<div class="post-metadata">

**Author:** ![dangolding](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@dangolding](https://community.grafana.com/u/dangolding)\
**Post date:** [September 3, 2019, 9:20am UTC](https://community.grafana.com/t/using-grafanas-api-though-kubernetes-proxy/20644/2 "2019-09-03T09:20:12Z")

</div>

This appears to be impossible as apparently kubectl proxy strips off authentication headers :’(. See here: [https://stackoverflow.com/a/57762020/1011724](https://stackoverflow.com/a/57762020/1011724)
