JS Redirect after Login on Embedded adds Subpath twice

We have Grafana embedded in a frame and with a subpath of /grafana as part of our main app (https://ourapp.domain.com/grafana" - all works great except if we need to login, we get a login page in the frame and put in user/pw, all good.

But after the login completes successfully, the JS in the login page redirects the browser to the ‘home’ page, but it’s adding the subpath (/grafana) to the base path (/grafana) which results in a redirect to /grafana/grafana which does not exist.

A page reload then makes all okay as we’re already logged in and the app works wonderfully; it’s just on first login this happens - we think due to the JS adding the subpath to the basepath, when all it should do is redirect to the base path.

This is behind an AWS ALB and then Nginx reverse proxy, but they don’t seem to affect this.

serve_from_sub_path and embedded are both true.

Steve