Search code examples
reactjsapigrafanagrafana-api

CORS in Grafana API


I want to enable cors on grafana so that I can make POST request on a react APP using grafana API. My issue is I can't set cors on grafana.

I have tried to edit the defaults.ini file for grafana but the issue of CORS Not enabled keeps persisting. How do I enable cors in Grafana?


Solution

  • No built-it CORS in Grafana, as discussed here and many times repeated over.

    You'll need to setup Reverse proxy that will handle CORS for you.General example of nginx config for this can be found here.

    Obviously nginx is just a suggestion: you can use any reverse proxy of your liking.

    Official reference on how to configure Grafana to run behind reverse proxy here.