NGINX Proxy from New Domain to Old Domain

I had a bit more of a think about this. I really feel like I had something like this working last week, but can’t seem to reproduce it now.

And on reflection, I’m actually not totally sure whether what you’re trying to do will work. Specifically, because you need Grafana to be available on two different domains, where it is served under a subpath one one, but not on the other. If it was a subpath on both, you would just enable the serve_from_sub_path flag on the Grafana server and be done with it, but I guess that’s not an option here.

As you correctly observed, if a user tries to go to /grafana/ on newdomain, if the proxying is working correctly, they will be served / on olddomain. So far so good, but Grafana will come back with a 302 Redirect response to /login, which itself is obviously not proxied. And I agree with you that trying to proxy every path that Grafana might send the user to is a fool’s errand.

What you need to do may be possible with some fancier rewrites on the nginx proxy, but I’m afraid I don’t have an answer off the top of my head.

1 Like