Running grafana behind IIS

Trying to follow doesn’t end with a working config, probably due to something that nginx does automatically (trying to use IIS here)

That being said, I’m trying to set up grafana with a “sub path”.
Shouldn’t the grafana server daemon to rewrite all requests properly, even for static content ?
That will enable a more portable setup without the need to specify ultra-needy details as of the right now missing…


root_url = %(protocol)s://%(domain)s:/grafana

why, for example, http://hostname:port/grafana/public/build/grafana.dark.css?v4.6.3 doesn’t get served properly ? (this http://hostname:port/public/build/grafana.dark.css?v4.6.3 works fine …)

summing up: what is needed to be rewritten and what is needed to be served statically if I want to use grafana with a sub-url ? has anyone accomplished the task with IIS and ARR ?

Sounds like IIS is not configured correctly then. Is the redirect working for the html pages?

for sure IIS is not configured ok, I was asking why the grafana daemon, when instructed to use a root_url which defines a sub_url, with all the parsing logic already done (it shows clearly in the log) can’t serve properly static files (without a proxy on front of it).
Without having static files served correctly by the daemon, the SPA obviously breaks.
If grafana could serve those static files correctly (i.e. “intercept” that “grafana” is the sub_url, so “grafana/public/*” needs to return the static assets) the proxy configuration could be much more easier.

Given it’s not (not sure if it’s a design decision or not) there should be a place where a config is shown with the exact requirements for url rewriting, and for static file serving.
I’m happy to be the testbed and provide screenshots/examples to be added to .

after a bit of trial and error, I found the settings. Would you include them in the official docs to avoid other falling in the same culprit I fell ? Thanks a lot.

I can provide additional details if needed to create a full guide.

This is an example to be able to use a sub-url as configured with

root_url = %(protocol)s://%(domain)s:/grafana


Thanks for posting the followup. I’ve been meaning to write some docs for this for ages and your example was a good start.

I updated the reverse proxy docs:

and wrote a tutorial for using IIS as a reverse proxy and using URL rewrite for subpaths:

1 Like

thank you! two small notes :

Thanks! Updated both.

1 Like

Please I need your help and suggestions, I want to access to grafana in local network trough my website that run in port 443 HTTPS, check my post : Access to grafana in local network trough https

Thank you very much !