Redirecting http traffic to https (Grafana, apache)

Hi,

I am using apache and grafana to deliver some pretty slick graphs! I am having some issues though redirecting non-ssl traffic to https. Right now, https traffic works fine as long as I go to the https://servername:3000 address. Usually this wouldn’t be too complicated as you would just redirect port 80 to 443 via iptables/firewall-cmd but it seems that grafana is only capable of listening on one port at a time. Would be nice to be able to combine http/https in one config file! Alas…

So, any tips on how to do this? My httpd.conf file is 100% default as it comes from a fresh yum install httpd. This is my grafana.ini (with the domain redacted):

[root@rzslcreport1 grafana]# grep -v ^# ./grafana.ini | grep -v ^; | grep -v “^[” | grep .
protocol = https
http_port = 3000
domain = example.org
root_url = %(protocol)s://%(domain)s:%(http_port)s/
cert_file = /etc/grafana/certificate.pem
cert_key = /etc/grafana/key.pem
enabled = true
config_file = /etc/grafana/ldap.toml
allow_sign_up = true

Any help is greatly appreciated.

Hi,

Since you’re referring to apache you should use http to https redirect configuration in apache to solve your problem. Grafana only supports listening on one port.

I would suggest google search “apache redirect http to https” for further instructions regarding apache configuration.

Marcus