Facing an issue with https, custom domain using apache2

  • What Grafana version and what operating system are you using?
    Grafana (9.0.7) on Windows Server 2012 hosted on Azure

  • What are you trying to achieve?
    I want to add the custom domain and want to redirect from localhost:3000

  • How are you trying to achieve it?
    We have installed apache2 and Grafana on the server.

  • What happened?
    Basically there are other 4 atlassian tools are hosted on the same server. localhost:3000 is not redirecting to mygrafanadomain.com. Also, while opening mygrafanadomain.com is opening atlassian tool. We checked each and every line in apache 2 and there is nothing which redirect it to atlassian tool.

  • What did you expect to happen?
    whenever http://localhost:3000 or http://mygrafanadomain.com is clicked then it should redirect to Grafana url along with https (it means the url should be https://mygrafanadomain.com)

  • Can you copy/paste the configuration(s) that you are having problems with?
    Grafana defaults.ini File

#################################### Server ##############################
[server]
#Protocol (http, https, h2, socket)
protocol = http
#protocol = https
I tried both http and https with no success.

#The ip address to bind to, empty will bind to all interfaces
#http_addr = 127.0.0.1
http_addr = localhost
I tried both no success.

#The http port to use
http_port = 3000
#http_port = 3000

#The public facing domain name used to access grafana from a browser
#domain = localhost
domain = mygrafanadomain.com

#Redirect to correct domain if host header does not match domain
#Prevents DNS rebinding attacks
;enforce_domain = false

#The full public facing url
#root_url = %(protocol)s://%(domain)s:%(http_port)s/
#root_url = %(protocol)s://%(domain)s:%(http_port)s/
root_url = https://mygrafanadomain.com/

#Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons.
#serve_from_sub_path = false


#Log web requests
router_logging = false

#the path relative working path
static_root_path = public

<VirtualHost mygrafanadomain.com:443>
    ServerName mygrafanadomain.com
	
	ErrorLog "${SRVROOT}/logs/error_grafana.log"
	TransferLog "${SRVROOT}/logs/access_grafana.log"
	
	ProxyRequests Off
	ProxyPreserveHost On
    
    <Proxy *>
		Require all granted
	</Proxy>
 
	SSLEngine On
	ProxyTimeout 300

	SSLCertificateFile /DATA/Apache24/certificates/SSLCERT.crt
	SSLCertificateKeyFile /DATA/Apache24/certificates/SSLCERT.key
	SSLCertificateChainFile /DATA/Apache24/certificates/SSLCERT-ca.crt
        ProxyPass / https://localhost:3000/
        ProxyPassReverse / https://localhost:3000/
</VirtualHost>

Thanks in advance
SultanPr

welcome to the :grafana: forum, @sultanpr

I’m curious, have you secured ssl/TLS certificates for the subdomain you’re running grafana on?

Have you tried making this work without using https and just using http?

Also, when you click the link, do you see anything interesting in your browser’s developer tools? specifically in the network tab?