From 899c57a8ba55935a788b2a8e6d8bfc6aa1914602 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Fri, 4 Mar 2022 09:43:13 +0100 Subject: [PATCH] added support to enable relative URLs in graphs #410 --- monitorix.cgi | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/monitorix.cgi b/monitorix.cgi index 16e7749..23d9dd3 100755 --- a/monitorix.cgi +++ b/monitorix.cgi @@ -310,11 +310,13 @@ if($config{include_dir} && opendir(DIR, $config{include_dir})) { $config{url} = ($config{url_prefix_proxy} || ""); if(!$config{url}) { - $config{url} = ($ENV{HTTPS} || ($config{httpd_builtin}->{https_url} || "n") eq "y") ? "https://" . $ENV{HTTP_HOST} : "http://" . $ENV{HTTP_HOST}; $config{hostname} = $config{hostname} || $ENV{SERVER_NAME}; - if(!($config{hostname})) { # called from the command line - $config{hostname} = "127.0.0.1"; - $config{url} = "http://127.0.0.1"; + if(lc($config{enable_relative_urls} || "") ne "y") { + $config{url} = ($ENV{HTTPS} || ($config{httpd_builtin}->{https_url} || "n") eq "y") ? "https://" . $ENV{HTTP_HOST} : "http://" . $ENV{HTTP_HOST}; + if(!($config{hostname})) { # called from the command line + $config{hostname} = "127.0.0.1"; + $config{url} = "http://127.0.0.1"; + } } } $config{url} .= $config{base_url};