The Grafana Box on the front page doesn't work when Grafana is behind a Web Proxy

Description

I have a requirement to put Apache HTTPD in front of the OpenNMS UI Servers and Grafana, to provide SSL and SSO for both applications.

OpenNMS and Grafana can be configured to be behind a proxy with SSL without issues, but the Grafana Box (and maybe the Vaddin Dashlet) will assume you'll connect to a Grafana server directly, which of course won't work in this configuration.

For example:

Let's say that the servername is "onms-server", and without Apache we have:

http://onms-server:8980/opennms/

http://onms-server:3000/

Normally, the Grafana box will work in this case.

Now, consider that we configure Apache HTTPD with SSL and Reverse Proxy in order to:

https://onms-server/opennms/ points to http://onms-server:8980/opennms/

https://onms-server/grafana/ points to http://onms-server:3000/

Normally, the above works without issues.

But, the code inside grafana-box.jsp breaks because of the new "sub-folder". The URLs will be something like "https://onms-server/api/search", instead of "https://onms-server/grafana/api/search". For this reason, besides the following:

We need an additional property that defaults to an empty string to include a sub-folder, for example:

When present, we can use that in front of the Grafana API calls to make sure it works.

Acceptance / Success Criteria

None

Lucidchart Diagrams

Activity

Christian Pape April 18, 2018 at 11:43 AM

Alejandro Galue March 13, 2018 at 7:37 PM

That name suggestion is perfect!

Jeff Gehlbach March 13, 2018 at 7:02 PM

Nice approach. I suggest `org.opennms.grafanaBox.basePath` for the ultimate property name, since it may be used in the absence of a proxy (e.g. with a hosted Grafana service).

Fixed

Details

Assignee

Reporter

Labels

Components

Sprint

Fix versions

Affects versions

Priority

PagerDuty

Created March 13, 2018 at 6:33 PM
Updated April 18, 2018 at 11:34 PM
Resolved April 18, 2018 at 11:34 PM