Login problems after migration and adding a proxy

Login problems after migration and adding a proxy

Sebastiaan Henau發表於
Number of replies: 5

I'm in the process of migrating Moodle to a different machine. I'll start with a bit of background about the infrastructure (I’m not sure it’s relevant, but better too much detail than not enough) before going on the describe the problem.

Before the migration Moodle ran in Docker containers and served a HTTPS site directly to the users. Now Moodle (3.8) runs inside Podman containers (supplied by Bitnami) and has a proxy in front of it. To get this to work I had to set the wwwroot and enable the following to options in config.php.

  • $CFG->reverseproxy = true;
  • $CFG->sslproxy     = true;

The site loads fine and can connect to the database. However, when I try to login I get the message “Invalid login, try again.” (or something similar, I’ve translated this from Dutch). This error isn’t caused by a wrong username/password. I’m positive I use a correct username and password. The users are present in the database (in the mdl_user table).

The self-register form works perfectly, I can create a new account. When I click the confirmation link in the email I received, I can access the site. However, when I log out and try to log in again, I get the same error message.

Does anyone have any idea what’s going on or how I can start to figure the problem out? I’m far from familiar with Moodle, so if I’ve overlooked some obvious debugging step I apologize. The bug isn’t likely to be caused by the way I performed the migration. I performed exactly the same steps on my local machine, except for the proxy, and got a fully functioning site as a result.


評比平均分數: -
In reply to Sebastiaan Henau

Re: Login problems after migration and adding a proxy

Visvanath Ratnaweera發表於
Particularly helpful Moodlers的相片 Translators的相片
In reply to Visvanath Ratnaweera

Re: Login problems after migration and adding a proxy

Sebastiaan Henau發表於
Yes I did. I just went back to double check and I can confirm the problem occurs with those apache settings.

Though I didn't perform the actions listed under the heading "The tricky part". Since I didn't find the setting anywhere and https://docs.moodle.org/38/en/HTTP_security mentions that it has been removed in Moodle > 3.4.
In reply to Sebastiaan Henau

Re: Login problems after migration and adding a proxy

Emma Richardson發表於
Documentation writers的相片 Particularly helpful Moodlers的相片 Plugin developers的相片
It could be that your database permissions or salt might have an issue - verify that your database user has full permissions on the database and make sure that the salt is correct...I know you said this same site works fine without the proxy but something might have been missed in the second migration.
In reply to Emma Richardson

Re: Login problems after migration and adding a proxy

Sebastiaan Henau發表於
The database user has full permission. I used the credentials Moodle is configured with to insert, update and delete a record in the mdl_user table.
The site was initially created with Moodle 3.4. If I understand correctly this means a unique salt is generated for each user and stored in the database. So if Moodle has access to the database there’s not much else I can do to verify the salt is correct?

I did find a new clue. When I try to login without entering a username I get the following error message.

Notice: Trying to get property 'id' of non-object in /bitnami/moodle/lib/moodlelib.php on line 4421

This page should automatically redirect. If nothing is happening please use the continue link below.
(Continue)

Error output, so disabling automatic redirect.