504 Gateway timeout

I’m using Grafana with Graphite+Carbon.

Most of the time I can perform queries just fine. With some particularly complicated queries, however, Grafana often (though not always) fails to load them and returns:

504 Gateway Timeout

Gateway Timeout
The gateway did not receive a timely response
from the upstream server or application.

What can I do to prevent this from happening and allow as long as it takes to complete these long queries?

Is there a setting on Grafana, Graphite, Graphite-web, or Carbon-cache I can change to fix this?

Maybe a setting in Graphite or carbon-cache. No timeout setting in Grafana (queries can take 10min or more)

Yes, we would also like to configure this Gateway timeout value, as some of our queries need a bit more time.

I have the same timeout error when using Elasticsearch as the data source. The query can be completed by directly sending request to ES’s API. But timeout in Grafana. The query will usually take 3 minutes to complete though

I see this still open, not sure if its related

The 504 (gateway) timeout is likely created by the backend where graphite will run longer than the mechanism serving the graphite data, for example the graphite-web or in my case it was nginx server was limited to 65 seconds.