Basic Auth error but works in incognito (interference with htpasswd in nginx?)

Hello, I’m in the process of setting up Grafana after getting Prometheus up and running. Right now I’m running into an issue where if I go to in my browser, I get this error as a json response:

{"message":"Invalid username or password"}

If I open the page in incognito mode, however, I get the standard login page and the login does work.

I noticed that if I turn auth.basic off in /etc/grafana/grafana.ini, the login screen does show up and I don’t get the error anymore. However, is this comprising security in any way since this is a public facing page?

I wonder this is related to the basic auth setup I did during the Prometheus installation. While setting up Prometheus, I created a new basic auth login with:

sudo htpasswd -c /etc/nginx/.htpasswd my_user

Could that somehow be interfering with Grafana’s login?

Here is what my Nginx config looks like:

# Grafana
location /grafana/ {
    proxy_pass http://localhost:3000/;

# Prometheus
location /prometheus/ {
    auth_basic "Prometheus server authentication";
    auth_basic_user_file /etc/nginx/.htpasswd;
    proxy_pass http://localhost:9090/;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;

location / {
    root /srv/www/home/;

Any help will be appreciated! I am really scratching my head here.

I don’t think I did anything special, but the error does not happen anymore! Perhaps there was some caching issue that resulted in the error.