Mikesch-mp / icingaweb2-module-grafana

Grafana module for Icinga Web 2 (supports InfluxDB & Graphite)
https://icinga.com/community/
GNU General Public License v2.0
241 stars 95 forks source link

graphs not working behind loadbalancer #279

Closed fl0wx closed 2 years ago

fl0wx commented 3 years ago

Expected Behavior

The graphs schould be shown

Current Behavior

if i access the icingaweb2 host directly the graph is loaded as expected. If i try to access the icingaweb2 host not directly, but with a loadbalancer, then the graphs arent shown.

Reason could be the "getBaseUrl" function.

this codefragment generates always a baseurl with the icingaweb2 host, not the balancerhost: https://github.com/Mikesch-mp/icingaweb2-module-grafana/blob/2cae443a51f964f01f83b59c5d206bba08bd944d/library/Grafana/ProvidedHook/Grapher.php#L219

I havent found any configuration property to change that behavior.

here is the function which is called by the grafana module: https://github.com/Icinga/icingaweb2/blob/b75cf362b8f3a64a028fd88c7cf8b40cfddb4c84/library/Icinga/Web/Url.php#L196

Your Environment

Littlericket commented 3 years ago

Same here. The module does not take in account that X-Forwarded-Host and X-Forwarded-Proto can be defined. But this looks like an upstream issue (icingaweb2) instead of a module error.

A solution to this is to pass the host argument to the next server (for ex. ProxyPreserveHost), so that icingaweb2 is "listening" on this hostname. A new virtualhost may be needed for this.

fl0wx commented 2 years ago

was an issue with balancer config