Error Javascript

Error Javascript

by Renan Albino Cunha -
Number of replies: 5

I am trying to install moodle 3.8.1 on a Centos 7 behind a loadbalancer (haproxy) and i dont know how to solve this problem it doesnt let me input the password for the admin user and the forums doest have any information on this.

Attachment error moodle javascript.PNG
Average of ratings: -
In reply to Renan Albino Cunha

Re: Error Javascript

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Renan,
503, Service Unavailable, means a configuration issue between HAproxy and Moodle.
Would you like to share a bit more info here? If you'll share snippets of your configurations, please replace sensitive info there.

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Error Javascript

by Renan Albino Cunha -

Hi Matteo, thanks for answering i am using HAproxy 1.8 and trying moodle 3.5 or 3.8 the configuration file of Moodle and HAproxy is there 

In reply to Renan Albino Cunha

Re: Error Javascript

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Renan,
I can't quickly setup an env like yours so I'm not able to test what described below wink.

On the Moodle side, besides $CFG->sslproxy, you should add $CFG->reverseproxy = true;. Besides, I'd suggest to use an actual boolean value instead of 1.
That should fix your issue.

On the HAproxy side, it seems fine unless some doubts below:

...
# SSL Security
 http-response set-header X-Frame-Options SAMEORIGIN if https_in
 http-response set-header X-Content-Type-Options nosniff if https_in
...
 rsprep ^Set-Cookie:\ (.*) Set-Cookie:\ \1;\ Secure if https_in
...
   server moodle1 172.17.3.167:80 source moodle.xxxxx.xxx.xx cookie web03 downinter 1s port 80 maxconn 1000 on-error mark-down check
   server moodle2 172.17.3.168:80 source moodle.xxxxx.xxx.xx cookie web03 downinter 1s port 80 maxconn 1000 on-error mark-down check
...
  1. Please double check HTTP Headers conf and the usage of the Moodle instance to prevent future issues (including Mobile App and LTI): https://docs.moodle.org/38/en/Moodle_app_guide_for_admins#Frame_embedding, Moodle is able to manage X-Frame-Options by its own
  2. Secure cookies can be manage by Moodle: https://docs.moodle.org/38/en/HTTP_security#Secure_cookies_only
  3. It looks like moodle1|2 and web03 should be changed unless those settings come from the anonym process

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Error Javascript

by Renan Albino Cunha -

Thanks for the response Matteo,

I changed the boolean of the  $CFG->reverseproxy = true;, but nothing changed

On the HAproxy things, I got from a colleague months ago when we were first implementing the application and I can't remember exactly why he did it. But I tried commenting the lines (one by one) to see if anything changed, nothing changed and the application showed the same errors of Javascript. sad


In reply to Renan Albino Cunha

Re: Error Javascript

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Renan,
mmhhh... let's start with the basics: does the Moodle installation actually work w/o HAproxy?
Please, comment out related $CFG proxy settings and set $CFG->wwwroot to the actual plain IP address of one of the two nodes and browse it with your browser.

HTH,
Matteo