How does nextcloud checks access to Internet?

I use the docker latest image, automatically updated when available (via Watchtower).

Since some time (probably a new version) I do not see any more apps categories:

image

Since I think they are sources off a central server (store), I checked the general settings and I see that my server is said not have access to Internet (below is the French version, it says “This server cannot connect to Internet: a few endpoints cannot be reached”

image

The container does have access to Internet, this is a test from within the container:

~ # docker exec -it nextcloud bash                                                                                                                     
root@f3aa8babf908:/var/www/html# curl http://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>

How does Nexcloud check Internet access? What are the “endpoints” it refers to?

Note: I added 'has_internet_connection' => true to the configuration just in case, though I never needed it before.

Found this at line 207 ff for you:

https://github.com/nextcloud/server/blob/stable20/apps/settings/tests/Controller/CheckSetupControllerTest.php

Thank you. My PHP skills are inexistent but

	$this->config->expects($this->at(0))
		->method('getSystemValue')
		->with('has_internet_connection', true)
		->willReturn(true);

seems to mean that having 'has_internet_connection' => true overrides the test. In that case (having that in the conf) I do not understand why I get the message .

You find the list of hosts which are used to test the internet access here. Due to the fact that the message is still shown although you’ve set the parameter indicates that the problem still persists and Nextcloud isn’t able to access the internet. Most likely you haven’t run you’re tests from within the docker container?!

I did run them from within the container.

In my question, in the code block, you will see first the line (ran from the docker host)

~ # docker exec -it nextcloud bash   

This brings me into the container (you can see that the prompt below changed):

root@f3aa8babf908:/var/www/html# curl http://google.com

The curl is successful.

For the sake of completeness, I tested (still from within the container) the addresses at https://github.com/nextcloud/server/blob/stable20/apps/settings/tests/Controller/CheckSetupControllerTest.php#L215

They all return 200, 301 or 302 - so properely reachable

Sorry i can not really help you. But perhaps the nextcloud code uses “ping” and not https requests. But it do not really know it. Perhaps it helps you.

It ended up being a configuration problem: 'proxy' => '172.19.0.31' was added to my configuration to debug something else.

This is not the proxy of the traffic coming TO Nextcloud, but the one Nextcloud should use to go OUT.

Removing it fixed the issue.

1 Like