Login Page redirect to login page after successfull login

Hello Team,

Greetings! Hope you all are fine in these corona times

This is regarding an issue we are stuck at since 2 weeks now. There are two things we require:

We are facing login issue on Grafana UI.
Whenever we try to login from Microsoft Edge browser, we are redirected to the login page again even if the admin creds are success.
When we use IE, we are successfully able to login to Grafana but the alignment in settings is distorted.
This appears to be s strange behavior to me. We are using Grafana 7.0.X. We are using Prometheus-operator helm chart to deploy Grafana.

Find in attached the ingress resource manifest which is configured and also the grafana.ini.

Could you please suggest a way to resolve the login issue?

Issue 2)
We also want to download plugins on the fly but due to proxy issue we are not able to do the same. Could let us know where, what and how can we inject the proxy details in the container so that the plugins are downloaded properly.

Thank you

Regards,
Yash BRAHMANI

Hello,

i’m having the same issue since a few hours.
After successful signup i get redirected to the login-page again.
This problem occurs if i try to login in from a different PC through the network.
If i try to sign in on the local machine every thing works just fine.

Any ideas how to fix the problem with signing in remotely?
Nothing changed in the setup.

Regards,

Lukas Bruder

Hi,

i was able to fix my problem by reseting my config.ini file and reconfiguring it.
I have exactly the same configs than before, but maybe there was an issue with loading it correctly.

Redards,

Lukas Bruder

Hi Lukas,

Could you please share your config.ini file?

It will help me in understanding my problem as well
Thank you

Regards,
Yash

Hi Lukas,
I don’t see your default.ini file. Can you resend to me please?

Regards,
Yash

Hi,

you can see the defaults.ini down below.

It’s pretty much the configs you have after installation.

In my case I did change allow_embedding to true and I did enable Anonymous authentification.

Redards,

Lukas Bruder

##################### Grafana Configuration Defaults #####################

Its not displaying the file at all

I can only see this line:
##################### Grafana Configuration Defaults #####################

Regards,
Yash

I have the issue that I can post more than 2 replies and the reply I send via e-mail can contain my ini-file.

Regards,

Lukas

Can you send your ini file to this email id please?
ID: yashbrahmani.nmims@gmail.com

Regards,
Yash

When I upodated Grafana from 6.7.x to 7.0.x, I had that issue.

I fix it clearing the browser data, cookies, etc… Now it works great on Grafana v7.1.1 (3039f9c3bd)

2 Likes

Hello @castillo92,

We tried doing the browser cache cleanup but it did not work for us. I will try with 7.1.1 version of Grafana and check. We will let you know

Thank you for your input

Regards,
Yash BRAHMANI

I’m sorry of hearing that.

The second point I think you should check is the Proxy settings of your webserver (I work with Apache) and check the proxy settings and subur address in grafana.ini

But I can’t help you much more because I installed Grafana in a Linux machine and yours is Windows

Hello @castillo92,

We are also setting it up on Linux VM on k8s cluster.
We are currently getting the following error in the grafana logs:
t=2020-08-13T07:17:48+0000 lvl=info msg=“Starting Grafana” logger=server version=7.1.1 commit=3039f9c3bd branch=HEAD compiled=2020-07-24T10:08:01+0000
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config loaded from” logger=settings file=/usr/share/grafana/conf/defaults.ini
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config loaded from” logger=settings file=/etc/grafana/grafana.ini
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from command line” logger=settings arg=“default.paths.data=/var/lib/grafana”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from command line” logger=settings arg=“default.paths.logs=/var/log/grafana”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from command line” logger=settings arg=“default.paths.plugins=/var/lib/grafana/plugins”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from command line” logger=settings arg=“default.paths.provisioning=/etc/grafana/provisioning”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from command line” logger=settings arg=“default.log.mode=console”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from Environment variable” logger=settings var=“GF_PATHS_DATA=/var/lib/grafana”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from Environment variable” logger=settings var=“GF_PATHS_LOGS=/var/log/grafana”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from Environment variable” logger=settings var=“GF_PATHS_PLUGINS=/var/lib/grafana/plugins”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from Environment variable” logger=settings var=“GF_PATHS_PROVISIONING=/etc/grafana/provisioning”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from Environment variable” logger=settings var=“GF_SECURITY_ADMIN_USER=admin”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Config overridden from Environment variable” logger=settings var=“GF_SECURITY_ADMIN_PASSWORD=*********”
t=2020-08-13T07:17:48+0000 lvl=info msg=“Path Home” logger=settings path=/usr/share/grafana
t=2020-08-13T07:17:48+0000 lvl=info msg=“Path Data” logger=settings path=/var/lib/grafana
t=2020-08-13T07:17:48+0000 lvl=info msg=“Path Logs” logger=settings path=/var/log/grafana
t=2020-08-13T07:17:48+0000 lvl=info msg=“Path Plugins” logger=settings path=/var/lib/grafana/plugins
t=2020-08-13T07:17:48+0000 lvl=info msg=“Path Provisioning” logger=settings path=/etc/grafana/provisioning
t=2020-08-13T07:17:48+0000 lvl=info msg=“App mode production” logger=settings
t=2020-08-13T07:17:48+0000 lvl=info msg=“Connecting to DB” logger=sqlstore dbtype=sqlite3
t=2020-08-13T07:17:48+0000 lvl=info msg=“Starting DB migration” logger=migrator
t=2020-08-13T07:17:49+0000 lvl=info msg=“Starting plugin search” logger=plugins
t=2020-08-13T07:17:49+0000 lvl=info msg=“Registering plugin” logger=plugins name=“Direct Input”
t=2020-08-13T07:17:49+0000 lvl=info msg=“HTTP Server Listen” logger=http.server address=[::]:3000 protocol=http subUrl=/grafana socket=
t=2020-08-13T08:37:09+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/ status=302 remote_addr=99.198.6.0 time_ms=0 size=37 referer=
t=2020-08-13T08:37:09+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/ status=302 remote_addr=99.198.6.0 time_ms=0 size=37 referer=
t=2020-08-13T08:37:09+0000 lvl=info msg=“Request Completed” logger=context userId=0 orgId=0 uname= method=GET path=/ status=302 remote_addr=99.198.6.0 time_ms=0 size=37 referer=

Following is the ingress:
annotations:
kubernetes.io/ingress.class: prometheus-nginx-ingress
nginx.ingress.kubernetes.io/rewrite-target: /

  - host: example.com
    http:
      paths:
      - backend:
          serviceName: prometheus-grafana
          servicePort: 80
        path: /grafana

I am using the Prometheus-operator helm chart to deploy grafana

grafana.ini

apiVersion: v1
data:
  grafana.ini: |
    [analytics]
    check_for_updates = true
    [grafana_net]
    url = https://grafana.net
    [log]
    mode = console
    [paths]
    data = /var/lib/grafana/data
    logs = /var/log/grafana
    plugins = /var/lib/grafana/plugins
    provisioning = /etc/grafana/provisioning
    [security]
    allow_embedding = true
    [server]
    domain = example.com
    root_url = http://%(domain)s/grafana/
kind: ConfigMap

second configmap

apiVersion: v1
data:
  run.sh: |-
    @test "Test Health" {
      url="http://prometheus-grafana/api/health"

      code=$(wget --server-response --spider --timeout 10 --tries 1 ${url} 2>&1 | awk '/^  HTTP/{print $2}')
      [ "$code" == "200" ]
    }
kind: ConfigMap

Could you please help understand the problem here?

Thank you

Regards,
Yash

Hello Team,

I tried to setup again but facing the same problem wherein I am redirected back to the login page even after successful login.
Could you please help me with this situation?

Regards,
Yash BRAHMANI

Having the same problem. Login iframe displays logged in and immediately returns to login screen.

Grafana v7.1.3 on Ubuntu 20.04.1 LTS
cookie_samesite = disabled (None wont work on chrome)
allow_embedding = true
Not sure if HTTPS required? Only able to run as http

Hello Team,

Can we have some inputs on this topic please?
We are still facing this problem.

Regards,
Yash BRAHMANI

1 Like

I’m not sure if it’s related, but we noticed similar behavior recently on an instance that we set up. The problem was with a mismatch between HTTP and HTTPS. I’m not quite sure whether it was a reverse proxy issue or a Grafana issue (or both); if I recall correctly Grafana was expecting connections over HTTPS, but was also accessible over HTTP - and whenever a user tried to log in over HTTP, they were always just redirected back to the login page.

I just noticed that your config has

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

i.e. you’re running under a sub path. I’m not really sure if your nginx config is right. For troubleshooting I would recommend taking out the /grafana/ sub path and trying to run on the top level of the domain if possible. Either way, I have a strong suspicion that something in the reverse proxy configuration isn’t quite right.

Finally, @yashbrahmani in one of your previous messages you said “We are currently getting the following error in the grafana logs”, but I don’t see any errors in what you posted - it looks quite normal. I imagine the “status 302” messages are redirects from / to /login (or similar).

Iframe embedding works in Edge using:
cookie_samesite = disabled
allow_embedding = true

Redirects to login when accessed from Chrome:

Request url: http://x.x.x.x:3000/login
Request method: post
Status code: 200
Response Header
Set-Cookie: The set cookie didn’t specify a same site attribute and was defaulted to same site = lax and was blocked because it came from a cross-site response which was not the response to a top level navigation. The set cookie had to have been set to same-site=none to enable cross-site usage

Request url: http://x.x.x.x:3000/login
Request method: get
Status code: 302

Chrome seems to want:
cookie_samesite = none
cookie_secure = true
Served from a secure connection (HTTPS)

I cannot run an HTTPS session!

Hello @svetb,

We tried to run at the on the top level of the domain and following is my observation:

  1. Redirected to login page in Edge and IE. It works in chrome.

There is a limitation with browsers IE and Edge browsers. Following is the description somewhere in GitHub issues about this problem:

I discussed IE 11 support with the team on whether we do/should/will support it. We really do not want to tons of work to keep Grafana working in IE11 but can fix some of the critical issues so that it mostly works . Getting the UI to be polished for IE11 is not a priority considering its market share and its poor support for modern CSS

  1. Even the distorted problem does not appear in chrome.

We would like to know the grafana.ini configuration which works fine in IE as well as in Edge and in chrome.

Could you please let us know the same.
Thank you

Regards,
Yash

Thanks for the feedback Yash, looks like I was barking up the wrong tree here. It does indeed sound like a browser-related issue. I’m afraid we’ve not done any testing with IE, so probably can’t help much beyond this.