Running behind passthrough proxy with URL rewriting


I am running Grafana 4.2.0 from the latest Docker image, behind an entreprise passthrough proxy (Pulse Secure) that heavily rewrites the URL.
If I do bypass the proxy, it works fine. If not, here are the results:

This is the landing page, which shows a Javascript fatal error (it fails parsing the URL):

And if I browse to the login page and submit the login form, it is not submitted with the correct URL (thus, 404 error):

Any idea?

To start with, you are probably going to have to change some settings in Grafana ('m guessing that it is the subpath being incorrect that is causing the 404’s):

How to change settings with Docker:

Thank you for the prompt answer.

I have tried multiple times to change the GF_SERVER_ROOT_URL.
On those screenshots, it it set to be http://ipofthemachine.
If I set it with the full URL of the pass-through proxy, I just get a blank page (because of 403 unauthorized).

The end of the url looks very strange: Port=5000+login. Is it Pulse Secure that does that?

Yes, that’s what it does. The URL is completely rewritten and does not match anything with what is actually sent to the web server.
For most applications, this is not an issue. But here, it looks like Grafana is parsing the URL on client-side, which breaks everything…

That sounds like a problem. Grafana is a Single Page App (SPA), the HTML pages that are served from the server are only a starting point before Angular takes over. Is there any way to change the rewrite rules in Pulse?

Not at my level, I am in a large company and this tool is imposed. But we still have an option to bypass the proxy: although it comes with a few downsides, it works.

I guess this is it for this issue then, at least I now know the why.