There are a number of options you can add to your ini file to tell Grafana how to build self-referential urls:
#################################### Server ##############################
[server]
# Protocol (http or https)
protocol = http
# The http port to use
http_port = 3000
# The public facing domain name used to access grafana from a browser
domain = localhost
# The full public facing url
root_url = %(protocol)s://%(domain)s:%(http_port)s/
You should start by setting the protocol, http_port and domain to the proper values. If you’re accessing Grafana on port 80 or 443 and don’t want to have the port explicitly in the url you can remove :%(http_port) from the root_url setting.