Request header field X-Panel-Id is not allowed by Access-Control-Allow-Headers in preflight response

I’m running a build of Grafana, v5.0.x – in both Firefox and Chrome, I can’t actually get any queries to draw. I can see the metric paths in the series, but nothing is ever drawn to the screen. In the dev console, I see this:

Failed to load http://internal.graphite.abc.com/render: Request header field X-Panel-Id is not allowed by Access-Control-Allow-Headers in preflight response.

I get this for any graph on any dashboard. My setup isn’t very complex at all, and a downloaded / installed version of Grafana works out of the box, without the above error.

I’m not exactly sure what this error means. If it’s related, I’m hosting my local build on a laptop at home that accesses the graphite host over VPN.

Hi,

I’m guessing your using data source configuration access=direct. What you’re describing is CORS related. If you can, please change access= proxy. If not, you need to configure graphite to respond to OPTIONS HTTP request and response with at least the header Access-Control-Allow-Headers with a value of X-Dashboard-Id, X-Panel-Id.

I actually looked into this earlier today and I think that we maybe shouldn’t add X-Dashboard-Id and X-Panel-Id headers if access=direct. I’ll investigate tomorrow and maybe create an issue for it.

Marcus

Yes, we’re using direct access – I’ll try proxy tomorrow, but I’m unsure of what the ramifications of that are? Should we have any other additional configuration setup for that?

Making it easier to understand what proxy/direct means is also something we’re working on.

Proxy access mode means that all requests to the data source will be proxied through grafana backend/server circumventing possible CORS issues. It doesn’t mean you have to setup some proxy server somewhere. Proxy is the default and the reason for that is because it’s what most users should use, if possible.

Marcus

Just created an issue regarding not sending headers when using direct mode.

Thanks for the explanation on proxy – it’s absolutely not what I expected it to mean! :slight_smile:
To confirm your suspicion, I tried setting our access to proxy, and graphs are now loading. Thank you!

That’s great :+1:

We have an open issue aiming to make this clearer: https://github.com/grafana/grafana/issues/11391

Thanks, out of curiosity, is there a performance difference between the two? I assume proxy will mean that the grafana servers will be burdened more in some way (which is totally fine, even desirable, since we can control that and can’t control user hardware)?

I would say yes, but in favor of proxy. The proxy things doesn’t put any big overhead to Grafana servers since the request is basically just forwarded thru Grafana server. Grafana are very lightweight and doesn’t require a lot of resources. Usually it is the time series databases that Grafana integrates against that needs a lot of resources. Proxy is always the better alternative I would say if nothing else stated for a specific data source.

Marcus