Mailing List Archive

Nextcloud-24.0.7 and proxy settings
Hi there,

I'm trying to setup a nextcloud instance inside a DMZ that has no direct
connection to the outside world, only via proxy. The proxy itself is working
fine, but I fail to configure nextcloud to actually use this proxy.

According to the docs, I tried setting the proxy field in config/config.php, i.e.

<?php
$CONFIG = array (
...
'proxy' => '10.46.1.109:3128',
'proxyuserpwd' => '',
...
);

But this setting seems to be ignored, tcpdump does not show any connection
attempt to that ip and nextcloud complains that it cannot connect to the
internet.

In another forum I found that in
/etc/apache2/vhosts.d/10_nextcloud_vhosts.conf, environment variables like
HTTP_PROXY and HTTPS_PROXY may be set, i.e.

<VirtualHost *:80>
...
SetEnv HTTP_PROXY 10.46.1.109:3128
SetEnv HTTPS_PROXY 10.46.1.109:3128
...
</VirtualHost>

But this also does not seem to work.

Any other ideas?

Thanks
Alex
Re: Nextcloud-24.0.7 and proxy settings [ In reply to ]
On Sunday, February 19, 2023 1:17:41 PM CET Alexander Puchmayr wrote:
> Hi there,
>
> I'm trying to setup a nextcloud instance inside a DMZ that has no direct
> connection to the outside world, only via proxy. The proxy itself is working
> fine, but I fail to configure nextcloud to actually use this proxy.
>
> According to the docs, I tried setting the proxy field in config/config.php,
> i.e.
>
> <?php
> $CONFIG = array (
> ...
> 'proxy' => '10.46.1.109:3128',
> 'proxyuserpwd' => '',
> ...
> );
>
> But this setting seems to be ignored, tcpdump does not show any connection
> attempt to that ip and nextcloud complains that it cannot connect to the
> internet.
>
> In another forum I found that in
> /etc/apache2/vhosts.d/10_nextcloud_vhosts.conf, environment variables like
> HTTP_PROXY and HTTPS_PROXY may be set, i.e.
>
> <VirtualHost *:80>
> ...
> SetEnv HTTP_PROXY 10.46.1.109:3128
> SetEnv HTTPS_PROXY 10.46.1.109:3128
> ...
> </VirtualHost>
>
> But this also does not seem to work.
>
> Any other ideas?

If using "fpm-php", add the following to your config:
env[HTTP_PROXY] = 10.46.1.109:3128
env[HTTPS_PROXY] = 10.46.1.109:3128

I have this in:
/etc/php/fpm-php8.1/site.conf

After this, run:
/etc/init.d/fpm-php restart

This is how I got it working on my end.

--
Joost
Re: [SOLVED] Nextcloud-24.0.7 and proxy settings [ In reply to ]
Hi there,

The problem has a rather simple cause and also a simple solution:

Nextcloud expects a working DNS server for resolving its own app server,
*then* it is using the proxy to access it.

After configuring a DNS proxy in my DMZ and ensuring that /etc/resolv.conf on
the nextcloud instance is correctly pointing to it, it suddenly works :-)

Alex


On Sonntag, 19. Februar 2023, 13:17:41 CET Alexander Puchmayr wrote:
> Hi there,
>
> I'm trying to setup a nextcloud instance inside a DMZ that has no direct
> connection to the outside world, only via proxy. The proxy itself is working
> fine, but I fail to configure nextcloud to actually use this proxy.
>
> According to the docs, I tried setting the proxy field in config/config.php,
> i.e.
>
> <?php
> $CONFIG = array (
> ...
> 'proxy' => '10.46.1.109:3128',
> 'proxyuserpwd' => '',
> ...
> );
>
> But this setting seems to be ignored, tcpdump does not show any connection
> attempt to that ip and nextcloud complains that it cannot connect to the
> internet.
>
> In another forum I found that in
> /etc/apache2/vhosts.d/10_nextcloud_vhosts.conf, environment variables like
> HTTP_PROXY and HTTPS_PROXY may be set, i.e.
>
> <VirtualHost *:80>
> ...
> SetEnv HTTP_PROXY 10.46.1.109:3128
> SetEnv HTTPS_PROXY 10.46.1.109:3128
> ...
> </VirtualHost>
>
> But this also does not seem to work.
>
> Any other ideas?
>
> Thanks
> Alex