it-novum / openITCOCKPIT

openITCOCKPIT is an Open Source system monitoring tool built for different monitoring engines like Nagios, Naemon and Prometheus.
https://openitcockpit.io/
GNU General Public License v3.0
263 stars 50 forks source link

Is it possible to set a custom webroot for reverse proxying on different url base path ? #1669

Closed Dark4Codrutz closed 2 weeks ago

Dark4Codrutz commented 5 months ago

as the title suggests, I was trying to figure out if OITC exposes some variable that overwrites app's requests base url.

What I need to achieve is to have OITC webapp GET requests get redirected to the correct URL path when running behind a reverse proxy with a prefix.

For example: I am reverse proxying OITC from www.website.com/monitor. As soon as the webapp loads it queries for www.website.com/users/login instead of www.website.com/monitor/users/login.

In the past I've been able to solve these kind of cases, where webapp uses absolute paths instead of relative paths, by configuring the webapp to use a different base url path, changing the default / to /monitor as per my example.

For php I've seen nextcloud doing it like this https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/reverse_proxy_configuration.html#overwrite-parameters

Is there anything similar available in OITC ?

ibering commented 5 months ago

Hi @Dark4Codrutz

Currently wo do not have such an configuration option.

I would recommend to go with an subdomain like monitor.website.com. This does not require any hacks for configuration changes

If you really like to tinker around, we do something similar with our internal Grafana. (sub_filter). https://github.com/it-novum/openITCOCKPIT/blob/e83c22ed4582cd2441f96b2c57592afc05b5bb9e/system/etc/nginx/openitc/master.conf#L93-L105

nook24 commented 2 weeks ago

As @ibering suggested, the recommended and documented solution is to use an reverse proxy to change for this. The docs provide example for Nginx and Apache2: https://docs.openitcockpit.io/en/additional/behind-reverse-proxy/