Error trying checking available updates - unexpected HTTP response code

Error trying checking available updates - unexpected HTTP response code

by Fatima Shaikh -
Number of replies: 15

We have Moodle instance (www.qmedcourses.in) hosted on Digital Ocean Droplet.

When I try to check available updates on the site - Settings > Site administration > Notifications- Check for Available Updates. I get following error.

I am facing the problem since I started the upgrade process for the new version 3.1.1.4 on our production server - https://www.moodle.qmedcourses.in/moodle3114. Also note our Moodle site is registered with Moodle.

===============

Unable to fetch available updates data - unexpected HTTP response code.

More information about this error

×Debug info: 403

Error code: err_response_http_code

×Stack trace:

line 246 of /lib/classes/update/checker.php: core\update\checker_exception thrown

line 124 of /lib/classes/update/checker.php: call to core\update\checker->get_response()

line 777 of /admin/index.php: call to core\update\checker->fetch()

=========================

I went to through the Forum Discussion with similar problem

https://moodle.org/mod/forum/discuss.php?d=353284
https://moodle.org/mod/forum/discuss.php?d=342300

From the discussion it seems that may be our IP address is blocked in the Moodle entity updates machine. (https://www.download.moodle.org). 

Can anyone please suggest some source to whom I can contact at https://download.moodle.org and asked them to delist my IP from their blocked list if it is so.

Or any other process I have to follow to resolve the problem.

Please any one suggest something I will be highly obliged.

Thanks & regards

Fatima Shaikh

fatima@qmed.ngo

Attachment moodle_error_24Nov.png
Attachment Moodle_Error_Notification.png
Average of ratings: -
In reply to Fatima Shaikh

Re: Error trying checking available updates - unexpected HTTP response code

by Fatima Shaikh -
Anyone with similar problem please help.
In reply to Fatima Shaikh

Re: Error trying checking available updates - unexpected HTTP response code

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
I would start by checking your firewall and network connection.
In reply to Emma Richardson

Re: Error trying checking available updates - unexpected HTTP response code

by Fatima Shaikh -
Thanks for the reply
Let me know what configuration needs to be checked for firewall and network connection

Awaiting for a help to resolve the problem.

Thanks & regards
Fatima Shaikh
In reply to Fatima Shaikh

Re: Error trying checking available updates - unexpected HTTP response code

by Christian Kanteng -
I have the same problem today when upgrading to 3.11.4. So anyone with the answer can share, please

Unable to fetch available updates data - unexpected HTTP response code.

More information about this error

×Debug info: 403
Error code: err_response_http_code
×Stack trace:
line 246 of /lib/classes/update/checker.php: core\update\checker_exception thrown
line 124 of /lib/classes/update/checker.php: call to core\update\checker->get_response()
line 777 of /admin/index.php: call to core\update\checker->fetch()
In reply to Christian Kanteng

Re: Error trying checking available updates - unexpected HTTP response code

by Ken Task -
Picture of Particularly helpful Moodlers

checker.php code at around 246 has this:
 
       $curlinfo = $curl->get_info();
        if ($curlinfo['http_code'] != 200) {
            throw new checker_exception('err_response_http_code', $curlinfo['http_code']);
        }
    return $response;

code retunred cannot be anything but 200.

The static link in downloads of latest releases shows that server to be:

https://download.moodle.org/

Got command line to your server?   If so, issue this curl command for I (information) and see what you get in return:

curl -I https://download.moodle.org/

That should return ...

HTTP/1.1 200 OK
Date: Mon, 29 Nov 2021 23:02:55 GMT

at the top of the returned info requested ... see the 200 OK?

That server is behind CloudFlare so if there is an issue with the ray (connectivity) upon which your request is using to get to that server, one could see the 403 ... access denied.

What are the last 2 lines seen in the output of that curl command on your server?  especially the last line: CF-RAY ... does give a clue ... my server, for example, does show a ray number with -DFW (meaning Dallas Fort Worth) on the end.

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Error trying checking available updates - unexpected HTTP response code

by Fatima Shaikh -
Thank you Ken for replying. Following is the output I get when I run the command curl -I https://download.moodle.org/

HTTP/2 403
date: Wed, 01 Dec 2021 03:42:52 GMT
content-type: text/html; charset=UTF-8
cf-chl-bypass: 1
permissions-policy: accelerometer=(),autoplay=(),camera=(),clipboard-read=(),clipboard-write=(),fullscreen=(),geolocation=(),gyroscope=(),hid=(),interest-cohort=(),magnetometer=(),microphone=(),payment=(),publickey-credentials-get=(),screen-wake-lock=(),serial=(),sync-xhr=(),usb=()
cache-control: private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
expires: Thu, 01 Jan 1970 00:00:01 GMT
x-frame-options: SAMEORIGIN
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
server: cloudflare
cf-ray: 6b694ed9fdb052c2-CCU

Request you to please suggest some solutions.

Thanks & regards
Fatima Shaikh
In reply to Fatima Shaikh

Re: Error trying checking available updates - unexpected HTTP response code

by Ken Task -
Picture of Particularly helpful Moodlers

See the last 2 lines of your curl test?

Can you guess as to what CCU stands for?

server: cloudflare
cf-ray: 6b694ed9fdb052c2-CCU

There is nothing you can do .. nor I ... it's up to whomever is administering the cloudflare setup for download.moodle.org to check into why that ray is being denied.

You might try to re-register your site (or attempt to update registration of your site).  See if that fixes ....

Other than that ... something filed by you in tracker?

https://tracker.moodle.org/secure/Dashboard.jspa

Or maybe if someone from moodle.org is listening or watching this thread they will jump in here and do whatever.

'SoS', Ken

In reply to Ken Task

Re: Error trying checking available updates - unexpected HTTP response code

by Fatima Shaikh -
Hi Ken,

No I can't guess what CCU stands. I re-register the site but the problem still exists. I filed the problem with tracker too & I got the attached reply from tracker team.Moodle Error - www.qmedcourses.in - Unable to fetch available updates data - unexpected HTTP response code.
@Kent, @Emma or any other in the community please help me resolve the issue or connect me with https://moodle.org so that they can check if my server IP is delisted with https://moodle.org.

Awaiting for a help.

Thanks & regards
Fatima Shaikh
In reply to Fatima Shaikh

Re: Error trying checking available updates - unexpected HTTP response code

by Ken Task -
Picture of Particularly helpful Moodlers

Response is strange ... responder says cannot duplicate using http://demo.moodle.net ... huh?  What?  http://  well, yeah ...

curl -I http://demo.moodle.net
HTTP/1.1 301 Moved Permanently
Server: awselb/2.0
Date: Wed, 01 Dec 2021 07:02:43 GMT
Content-Type: text/html
Content-Length: 134
Connection: keep-alive
Location: https://demo.moodle.net:443/

If we try https on curl -I we get:

curl -I https://demo.moodle.net
HTTP/2 301
date: Wed, 01 Dec 2021 07:05:22 GMT
content-type: text/html
content-length: 162
location: https://sandbox.moodledemo.net
server: nginx

Neither of those shows behind cloudflare so we're not talking here somehow!

Your server:

www.qmedcourses.in.    3600    IN    A    128.199.22.30

shows Digital Ocean.

The the moodle @https://www.moodle.qmedcourses.in/moodle3114

curl -I https://www.moodle.qmedcourses.in
HTTP/1.1 200 OK
Date: Wed, 01 Dec 2021 07:08:29 GMT
Server: Apache/2.4.29 (Ubuntu)
Last-Modified: Tue, 21 Sep 2021 05:42:12 GMT
ETag: "1b-5cc7adbfe7255"
Accept-Ranges: bytes
Content-Length: 27
Content-Type: text/html

curl -I https://www.moodle.qmedcourses.in/moodle3114/
HTTP/1.1 200 OK
Date: Wed, 01 Dec 2021 07:15:25 GMT
Server: Apache/2.4.29 (Ubuntu)
Set-Cookie: MoodleSession=4rhvc950ktdf0efqv1781gb7f4; path=/moodle3114/; secure
Expires: Mon, 20 Aug 1969 09:23:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Content-Language: en
Content-Script-Type: text/javascript
Content-Style-Type: text/css
X-UA-Compatible: IE=edge
Cache-Control: post-check=0, pre-check=0, no-transform
Last-Modified: Wed, 01 Dec 2021 07:15:25 GMT
Accept-Ranges: none
X-Frame-Options: sameorigin
Content-Type: text/html; charset=utf-8

Anyhoo ... what do you have for a firewall on your Ubuntu server Droplet?

Here's what I  can find:

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-20-04

'SoS', Ken

In reply to Fatima Shaikh

Re: Error trying checking available updates - unexpected HTTP response code

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

I'm going to take a guess that CCU is the Cloudflare data centre handling Fatima's request and that this is based on the nearest airport, CCU being the IATA code for Netaji Subhas Chandra Bose International Airport in Kolkata, India. When I run curl -I https://download.moodle.org/ I see cf-ray: 6b6b74feb8db7701-LHR, LHR being Heathrow Airport in London, UK. (Ken: Was this an exercise for the reader?)

However it's the cf-chl-bypass: 1 that might be the problem. This isn't very well documented but it looks like Cloudflare serves a CAPTCHA page when it sends this header which obviously your Moodle site cannot respond to. (One of the few references to this was in section 7.1.2 here).

If a CAPTCHA is being sent then the question is why? Maybe Cloudflare is determining that there are suspicious requests coming from your IP address. I also found this post suggesting the order of headers in the request may trigger this. Run curl -I -v https://download.moodle.org/ (with the -v option) which will show the request headers. Does Host: appear before User-Agent:? On my system (where I get the expected 200 OK response), I see:

$ curl -I -v https://download.moodle.org/

> HEAD / HTTP/2
> Host: download.moodle.org
> User-Agent: curl/7.66.0 

If you think the problem is with the remote end you could log another ticket in Tracker but make sure you select Project: Moodle Community Sites (MDLSITE) at the top and include your public IP address.

Average of ratings: Useful (1)
In reply to Leon Stringer

Re: Error trying checking available updates - unexpected HTTP response code

by Ken Task -
Picture of Particularly helpful Moodlers

Wasn't really an 'exercise' for the reader/poster ... do know that (in the past) rays of CF would putz and thought that might be poster's case.

Airports .... makes sense ... guess DFW is the largest most well known ... am in San Antonio ... we've got an airport and a 'code' ... SAT ... my test of curl picked DFW rather than SAT.

Been working all day on Google's 2 Factor 'roll out'.   It finally came my way and 2 of my 3 accounts by other domains now have issues with EMail ... and their use in Moodle's Oauth2 using Google.  GRRRRR!

'SoS', Ken

In reply to Christian Kanteng

Re: Error trying checking available updates - unexpected HTTP response code

by Mark Paget -
Hi Christian - may I please request you try again now as I've recently updated 12 ip ranges to ignore when MoodleBot is the user agent. If still not working please raise a ticket - https://tracker.moodle.org/projects/MDLSITE/issues/MDLSITE-6575?filter=allopenissues - with output from the following command included: curl -I -A 'MoodleBot/3.11' https://download.moodle.org/

Thanks,

Mark
In reply to Mark Paget

Re: Error trying checking available updates - unexpected HTTP response code

by Fatima Shaikh -
Thanks Mark for the reply. I checked its working now.
Problem resolved.

Once again thank you everyone for the help.

regards
Fatima Shaikh
In reply to Mark Paget

Re: Error trying checking available updates - unexpected HTTP response code

by Christian Kanteng -
Thanks Mark, it is working now and Thanks to everyone.
Regards,
Christian