Too Many Redirects - Moodle 4.1

Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
Broj odgovora: 23
Hello everybody, here I am again...

Using Google Cloud and Ubuntu to my server.
Finally I could install Moodle (previously related here), but now I'm receiving the ERR_TOO_MANY_REDIRECTS error.
My SSL is on Cloud Load Balancing, and the connection from the domain to the server is by Port 80.

So far I tried:
  • Comment the line on the admin/index.php => redirect(“index.php?sessionstarted=1&lang=$CFG->lang”);
  • Clean Cache and Session files
  • Check the permission on Moodle Data (777), tried even 755, 0755
  • It's a clean install, so no 3rd plugin
  • Include  $CFG->sslproxy = true; on config.php

Any other idea?


Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Leon Stringer -
Slika Core developers Slika Particularly helpful Moodlers
Odgovor na Leon Stringer

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
Tried now, no success tužan
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Leon Stringer -
Slika Core developers Slika Particularly helpful Moodlers

Check $CFG->wwwroot and compare this to the URL being entered in the browser.

A Moodle site has a single canonical URL which must be defined in $CFG->wwwroot. This is the URL which all users will use to access the site in the browser.

Moodle verifies the URL it has been accessed with matches $CFG->wwwroot. With situations such as the Moodle web server being behind reverse proxy, or the TLS (SSL) endpoint being in front of the Moodle web server, then the URL that Moodle detects will be different. For these scenarios there are options $CFG->reverseproxy = true and $CFG->sslproxy = true which allow the URL that Moodle detects at the web server to differ from that used in the browser. If Moodle detects it has been accessed with an unexpected URL it will redirect to the URL in $CFG->wwwroot. If the expected and detected URLs conflict then this redirect occurs until the browser gives up ("Too many redirects).

These replies may help.

Odgovor na Leon Stringer

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
Yes, it's the same =/
I think it's something else only because when I change the wwwroot for http:// instead of https:// the page loads (without theme, but ''functional'')
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
Up, for a desperation
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
I use cloudflare with an nginx reverse proxy in the middle - this is what my config looks like
$CFG->sslproxy=1;
My reverse proxy setting is commented out (that means I tried that and it broke!!).
Odgovor na Emma Richardson

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
Also, I would suggest just forcing your domain to https too - you could always install a local letsencrypt cert as well for the domain to use but you would do better to put dns on your local domain pointing to the cloud ssl proxy and have all the traffic route the same way.
Odgovor na Emma Richardson

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
That's it!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I don't know if helped either use the replace tool that Ken gave me idea, but when I put sslproxy=1 it's perfect, THEME WORKING, EVERYTHING WORKING!!!!!
Thank you SO much, saved me and my project!
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
Yay! Glad to be of help - I remembered fighting with that same issue when I first started messing around with ssl proxy's etc...
Odgovor na Emma Richardson

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
Hello Emma and Ken again tužan
For no apparent reason, the Theme disappears again. All the images that I uploaded is appearing, but the CSS seems not responsible. Any idea?
https://edu.tigabytes.com
Some situations, as Purge Cache, reset to show almost the entire page (Except buttons), but any next page, broken again.

Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
What have you changed? Something must have happened...is your moodledata folder still accessible? Permissions? Did you update or change your theme? Is that folder accessible (web service owner and correct permissions?). Did you add something to the CSS settings that might be causing this?
Odgovor na Emma Richardson

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
I installed 2 themes, to test. Nothing changed after that, went back to the original. That last friday.
Checked 0777 to Moodle Data and Moodle, no change into CSS tužan
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
How about php - did you do any server upgrades in the background?
Odgovor na Emma Richardson

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
ET https://edu.tigabytes.com/lib/javascript.php/1696349562/lib/requirejs/require.min.js net::ERR_CONTENT_DECODING_FAILED 200 (OK)
index.php:10 GET https://edu.tigabytes.com/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple-min.css net::ERR_CONTENT_DECODING_FAILED 200 (OK)
index.php:35 GET https://edu.tigabytes.com/lib/javascript.php/1696349562/lib/javascript-static.js net::ERR_CONTENT_DECODING_FAILED 200 (OK)
index.php:35 GET https://edu.tigabytes.com/theme/yui_combo.php?rollup/3.17.2/yui-moodlesimple-min.js net::ERR_CONTENT_DECODING_FAILED 200 (OK)
index.php:34 GET https://edu.tigabytes.com/lib/javascript.php/1696349562/lib/polyfills/polyfill.js net::ERR_CONTENT_DECODING_FAILED 200 (OK)
index.php:10 GET https://edu.tigabytes.com/theme/styles.php/boost/1696349562_1695058624/all net::ERR_CONTENT_DECODING_FAILED 200 (OK)
index.php:200 Uncaught TypeError: Cannot read properties of undefined (reading 'js_pending')
at index.php:200:8
(anonymous) @ index.php:200
index.php:239 Uncaught ReferenceError: Y is not defined
at index.php:239:14
at index.php:243:3

Looks like javascript issues...or something in the theme folder - how did you install those new themes? (I pulled those errors from Google developers tools/console tab)
Odgovor na Emma Richardson

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
PHP seems ok, same as before (7.4)
I installed new themes straight from Moodle site to my site. I deleted them this afternoon, but I'm stuck in the update, gives me a server error when I try to update the database.
About the slash arguments, sorry, I didn't understand. Is in Config.php? I tried them on and off, just because of it it's commented
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
What is the server error? Slash arguments is in the admin settings which you should still be able to get to without any theme...so you copied the folders over or the whole theme directory? If you copied the whole theme directory, there is your issue...delete it and find a copy of the theme directory from your 4.1 version code and move it over to your new site...
Odgovor na Emma Richardson

Re: Too Many Redirects - Moodle 4.1

napisao/la Guilherme Marcuci -
I installed the theme using “install now” here in the oficial Moodle page.
The error server trying to update the installation is: stream timeout
I tried to install a clean Moodle, but same problems.. Tried copying the Config.php and creating a new one.
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Emma Richardson -
Slika Documentation writers Slika Particularly helpful Moodlers Slika Plugin developers
Then I would look at Ken's questions. Stream timeout suggests a php setting is not right or the connection to the database is wonky. Again, something had to change after it was working...
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Umme Kawser Sinthia -
Hi Marcuci,
About the CSS not working, you'll have to add a location block into your nginx.conf file. I solved this by using this block. Can you please give me your config.php file, how you solved your too many redirects problem?

location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php-fpm/www.sock;
include fastcgi_params;
fastcgi_param PATH_INFO \$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
}
 
Best Regards,
Sinthia
Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Ken Task -
Slika Particularly helpful Moodlers
So tell us something about "Cloud Load Balancing" (CLB) setup.
Does Google's CLB consist of nodes?
Theme's don't 'disappear' ... they might get wonky looking ... everything is left justified (like it is now) ... but not completely gone!  

If GLB uses nodes, what node were you on when you installed and messed with the themes?   Did the installs of themes and messing with css get to every node?

In your GLB setup, there is one DB server (10. ip?), one location for moodledata (dedicated storage or another 10. IP server) and X nodes for the ubuntu web servers.

'SoS', Ken

Odgovor na Guilherme Marcuci

Re: Too Many Redirects - Moodle 4.1

napisao/la Ken Task -
Slika Particularly helpful Moodlers
You had issues getting installed to begin with ... when you initially installed, were you using http or https?  If Letsencript cert was broken at the time (and that can happen), you flipping between http and https could cause a situation where some internal links to moodle have http and some have what you want https.

Viewing the site with FireFox (no Chrome) so you see a 'broken lock'?   Somewhere FireFox would tell you that *some* objects/images/other links on the page weren't https.

If you can set it so you can login and go to the admin area of the moodle could use the https search and replace tool, me thinks.

And you might have to manually erase caches on the server:
moodledata/muc/ moodledata/cache/ moodledata/localcache
That should be safe to do as they are regenerated as site is used.

'SoS', Ken