Search code examples
dockernginxsonarqubehttp-status-code-401

Can’t reset the admin password after the first login to sonarqube


I've installed sonarqube using docker:

docker run -d --name sonarqube -p 9000:9000 sonarqube:lts-community

It runs successfully and when I login to it via https://my-sonar.something/ and admin/admin creds, I'm redirected to the password reset page which is fine. BUT:

when I reset the password, it doesn't accept it, and it throws a 401 error and then forwards me to the login page again without changing the password.

enter image description here

I've tried to use other sonar images, but that wasn’t the issue.

I've Nginx in front of my sonar instance as a reverse proxy, but there is no much there:

server {
    listen 443 ssl;

        include /etc/nginx/includes/ssl.conf;
        server_name  sonarqube.cool;
        error_log /var/log/nginx/sonarqube.error.log warn;
        access_log /var/log/nginx/sonarqube.access.log upstream_time;

    location / {

        proxy_pass http://some-ip-address:9000/;

    }
}


Solution

  • The error was from another Nginx configuration "in front of my Nginx conf above" used as SSL termination.

    Anyway, I was setting HTTPOnly in proxy_cookie_path inside Nginx conf. removing it solved the issue.

    https://community.sonarsource.com/t/sonarqube-logs-me-out-on-any-save-operation/8837/12?u=raedshari