TypeError problem when navigating some sections of the site

TypeError problem when navigating some sections of the site

by Gerlando Lo Savio -
Number of replies: 3

Hello, I recently installed Moodle 3.11 on an Ubuntu 20.04 server running Apache 2.4, PHP 7.4 and MySQL 8.0, located at https://scuola.itolman.net 

I often get a "TypeError: Cannot create property 'stack' on string 'Forbidden'" error when visiting some pages of the site - most often when I try to use the "Messages" and "Dashboard" pages of Moodle, like in this screenshot: 

TypeError Cannot create property 'stack' on string 'Forbidden' error when trying to open messages

Usually I need to reload the page to workaround this problem.

Sometimes I even get a "403 Forbidden -You don't have permission to access this resource." error page from Apache server: 

Forbidden you don't have the permission to access this resources

Again, reloading the page seems to work around the problem. 

Where should I look to try to understand and fix this problem? 

Thanks in advance,

Gerlos


Average of ratings: -
In reply to Gerlando Lo Savio

Re: TypeError problem when navigating some sections of the site

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I would start with the Apache error logs...
Average of ratings: Useful (1)
In reply to Jon Witts

Ri: Re: TypeError problem when navigating some sections of the site

by Gerlando Lo Savio -
Good point -  I should have thought of that. 😅
I looked at /var/log/apache2/error.log and found it was my fault.

I found several lines like this:

[Sat Jun 12 00:27:53.398305 2021] [evasive20:error] [pid 33171] [client xx.xx.xx.xx:60850] client denied by server configuration: /var/www/scuola.itolman.net/lib/ajax/service.php, referer: https://scuola.itolman.net/my/index.php?lang=en

The cause is that I have enabled mod_evasive on Apache, and my previous configuration was too restrictive. 

To solve the problem I needed to edit /etc/apache2/mods-enabled/evasive.conf and set DOSPageCount to 8 and DOSSiteCount to 100. 

Thanks again for your suggestion! 
-Gerlos


Average of ratings: Useful (2)
In reply to Gerlando Lo Savio

Re: Ri: Re: TypeError problem when navigating some sections of the site

by Jon Witts -
Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Glad you got it resolved, and thank you for sharing the fix back smile
Average of ratings: Useful (1)