Using proxy server within nextcloud

I’m a newbie when it comes to nextcloud.
I’m running a nextcloud 10.0.1 installation on a LAMP server.
A firewall is setup to allow incoming connections over 443. And a https_proxy server is used when I need to update the server using yum and connecting to the internet.

Right now when I go to Apps within the webgui it takes a while to see all the apps. A message appears on the top of the screen saying the page could not be loaded. Refreshing in 5 seconds.

Looking in the logs I see:
Could not get categories: cURL error 28: connect() timed out!","level":3,"time":"2016-09-28T13:05:03+00:00

and

Could not get application: cURL error 28: connect() timed out!

I think the installation is unable to connect to the internet due to way we setup the host.
Is there a way to add a proxy server so that the nextcloud installation can for new versions of apps and for the installation?

Thanks!

This might helps you:

You can make a alias in your ~/.bashrc file :

alias curl="curl -x <proxy_host>:<proxy_port>"
Another solution is to use (maybe the better solution) the ~/.curlrc file (create it if it does not exist) :

proxy = <proxy_host>:<proxy_port>

Try setting the proxy url and authentication in the config/config.php file. For example,

‘proxy’ => ‘myproxy.server.ext’,
‘proxyuserpwd’ => ‘username:password’

Take a look at config/config.sample.php for more information.

1 Like

Looks like this option helped getting all the internet related connection errors out of the log. The Admin pages and Apps pages load a lot quicker now.

Thanks for the help!

Although it looks like to proxy is working, I’m still getting errors. Especially when nextcloud is checking for updates:

I’ve anonimized the ipaddresses. 1.1.1.1 is my outside IP and 2.2.2.2 in my internal squid host.
Curl is stating it gets a permission denied, I cannot find any clue of this in the logging of the squid host.

“cURL error 7: Failed to connect to 2.2.2.2: Permission denied”

Also it looks like the installation is still looking at owncloud.

\/var\/www\/file\/settings\/Controller\/CheckSetupController.php(195): OC\\Http\\Client\\Client->get(‘https:\/\/www.own…’)\n#10

But looking at the config.php I see it needs to look at https://updates.nextcloud.org/updater_server/, but this is turned off.

‘updatechecker’ => false,
‘updater.server.url’ => ‘https://updates.nextcloud.org/updater_server/’,
‘updater.release.channel’ => ‘stable’,

And when I telnet to the squid proxy and running these commands, all is okay.

root@centoshost config]# telnet 2.2.2.2 3128
Trying 2.2.2.2...
Connected to 2.2.2.2.
Escape character is '^]'.
GET http://www.google.com/ HTTP/1.1
host:www.google.com

HTTP/1.1 302 Moved Temporarily
Cache-Control: private
Content-Type: text/html; charset=UTF-8
Location: http://www.google.be/?gfe_rd=cr&ei=IVQPWPi1JbLH8Aft0qPoBw
Content-Length: 258
Date: Tue, 25 Oct 2016 12:46:25 GMT
X-Cache: MISS from ubuntuhost
X-Cache-Lookup: MISS from ubuntuhost:3128
Via: 1.1 ubuntuhost (squid/3.3.8)
Connection: keep-alive

<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.be/?gfe_rd=cr&amp;ei=IVQPWPi1JbLH8Aft0qPoBw">here</A>.
</BODY></HTML>

Anyone any ideas on how this can be corrected?

{"reqId":"c8dA+WKZMIVFqdb4nCJW","remoteAddr":"1.1.1.1","app":"index","message":"Exception: {\"Exception\":\"GuzzleHttp\\\\Exception\\\\ConnectException\",\"Message\":\"cURL error 7: Failed to connect to 2.2.2.2: Permission denied\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/guzzle\\\/src\\\/RequestFsm.php(104): GuzzleHttp\\\\Exception\\\\RequestException::wrapException(Object(GuzzleHttp\\\\Message\\\\Request), Object(GuzzleHttp\\\\Ring\\\\Exception\\\\ConnectException))\\n#1 \\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/guzzle\\\/src\\\/RequestFsm.php(132): GuzzleHttp\\\\RequestFsm->__invoke(Object(GuzzleHttp\\\\Transaction))\\n#2 \\\/var\\\/www\\\/file\\\/3rdparty\\\/react\\\/promise\\\/src\\\/FulfilledPromise.php(25): GuzzleHttp\\\\RequestFsm->GuzzleHttp\\\\{closure}(Array)\\n#3 \\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/ringphp\\\/src\\\/Future\\\/CompletedFutureValue.php(55): React\\\\Promise\\\\FulfilledPromise->then(Object(Closure), NULL, NULL)\\n#4 \\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/guzzle\\\/src\\\/Message\\\/FutureResponse.php(43): GuzzleHttp\\\\Ring\\\\Future\\\\CompletedFutureValue->then(Object(Closure), NULL, NULL)\\n#5 \\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/guzzle\\\/src\\\/RequestFsm.php(135): GuzzleHttp\\\\Message\\\\FutureResponse::proxy(Object(GuzzleHttp\\\\Ring\\\\Future\\\\CompletedFutureArray), Object(Closure))\\n#6 \\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/guzzle\\\/src\\\/Client.php(165): GuzzleHttp\\\\RequestFsm->__invoke(Object(GuzzleHttp\\\\Transaction))\\n#7 \\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/guzzle\\\/src\\\/Client.php(125): GuzzleHttp\\\\Client->send(Object(GuzzleHttp\\\\Message\\\\Request))\\n#8 \\\/var\\\/www\\\/file\\\/lib\\\/private\\\/Http\\\/Client\\\/Client.php(137): GuzzleHttp\\\\Client->get('https:\\\/\\\/www.own...', Array)\\n#9 \\\/var\\\/www\\\/file\\\/settings\\\/Controller\\\/CheckSetupController.php(195): OC\\\\Http\\\\Client\\\\Client->get('https:\\\/\\\/www.own...')\\n#10 \\\/var\\\/www\\\/file\\\/settings\\\/Controller\\\/CheckSetupController.php(346): OC\\\\Settings\\\\Controller\\\\CheckSetupController->isUsedTlsLibOutdated()\\n#11 [internal function]: OC\\\\Settings\\\\Controller\\\\CheckSetupController->check()\\n#12 \\\/var\\\/www\\\/file\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(160): call_user_func_array(Array, Array)\\n#13 \\\/var\\\/www\\\/file\\\/lib\\\/private\\\/AppFramework\\\/Http\\\/Dispatcher.php(90): OC\\\\AppFramework\\\\Http\\\\Dispatcher->executeController(Object(OC\\\\Settings\\\\Controller\\\\CheckSetupController), 'check')\\n#14 \\\/var\\\/www\\\/file\\\/lib\\\/private\\\/AppFramework\\\/App.php(111): OC\\\\AppFramework\\\\Http\\\\Dispatcher->dispatch(Object(OC\\\\Settings\\\\Controller\\\\CheckSetupController), 'check')\\n#15 \\\/var\\\/www\\\/file\\\/lib\\\/private\\\/AppFramework\\\/Routing\\\/RouteActionHandler.php(47): OC\\\\AppFramework\\\\App::main('CheckSetupContr...', 'check', Object(OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer), Array)\\n#16 [internal function]: OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler->__invoke(Array)\\n#17 \\\/var\\\/www\\\/file\\\/lib\\\/private\\\/Route\\\/Router.php(293): call_user_func(Object(OC\\\\AppFramework\\\\Routing\\\\RouteActionHandler), Array)\\n#18 \\\/var\\\/www\\\/file\\\/lib\\\/base.php(983): OC\\\\Route\\\\Router->match('\\\/settings\\\/ajax\\\/...')\\n#19 \\\/var\\\/www\\\/file\\\/index.php(48): OC::handleRequest()\\n#20 {main}\",\"File\":\"\\\/var\\\/www\\\/file\\\/3rdparty\\\/guzzlehttp\\\/guzzle\\\/src\\\/Exception\\\/RequestException.php\",\"Line\":49}","level":3,"time":"2016-10-25T14:37:25+02:00","method":"GET","url":"\/index.php\/settings\/ajax\/checksetup","user":"admin"}