Client push: reverse proxy not reachable at setup wizard

Nextcloud version: 25.0.2
Operating system and version: Raspbian 10 Buster
Apache or nginx version: Apache 2.4.38
PHP version: 8.1

Hi,
I would like to install client push for nextcloud. My hardware configuration is a Raspberry Pi 4 behind a router and Let’s encrypt. Nextcloud works without problems.
During notify_push setup wizard

sudo -u www-data php /var/www/nextcloud/occ notify_push:setup

I get the following error

...
Push binary seems to be running already
âś“ push server seems to be functioning correctly.
Run the following commands to enable the proxy modules
    sudo a2enmod proxy
    sudo a2enmod proxy_http
    sudo a2enmod proxy_wstunnel

Then place the following within the <VirtualHost> block of the apache config for your nextcloud installation
which can usually be found within /etc/apache2/sites-enabled/
Note that there might be both an http and https config file

ProxyPass /push/ws ws://127.0.0.1:7867/ws
ProxyPass /push/ http://127.0.0.1:7867/
ProxyPassReverse /push/ http://127.0.0.1:7867/


And reload apache using sudo systemctl restart apache2
Press enter to continue or ESC to cancel...

'push binary doesn`t seem to be reachable trough the reverse proxy, did you follow the above instructions?.'
...

I have already searched through all possible threads, but there was no solution for me.
I hope to get the help here.

Here are some relevant code snippets.

I used the following code in the config.php of nextcloud

...
 'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '::1',
    2 => internal router ip,
    3 => internal raspi ip,
  ),
...
  'memcache.local' => '\OC\Memcache\APCu',
  'memcache.locking' => '\OC\Memcache\Redis',
  'memcache.distributed' => '\OC\Memcache\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 0.0,
  ),

The notify_push.service is as given from the setup wizard

[Unit]
Description = Push daemon for Nextcloud clients

[Service]
Environment=PORT=7867
Environment=NEXTCLOUD_URL=https://domain.xyz/nextcloud
ExecStart=/var/www/nextcloud/apps/notify_push/bin/armv7/notify_push /var/www/nextcloud/config/config.php
User=www-data

[Install]
WantedBy = multi-user.target

Here the Apache conf

<VirtualHost *:443 *:4545>
...
	ProxyPass /push/ws ws://127.0.0.1:7867/ws
	ProxyPass /push/ https://127.0.0.1:7867/
	ProxyPassReverse /push/ https://127.0.0.1:7867/
...

The problem lies certainly on the Proxy-Settings. The error comes with or without ProxyPass-settings. I tried a lot, also with http and https, but it does not work. I can’t find anything related in the log-files. I hope, someone has a solution approach for me.

Thanks in advance
I will gladly provide more information if needed.
Thomas

Hi Thomas,

Are the requested Apache proxy modules installed and enabled? You may have to restart the webserver to get them up and running…

Smn

Yes, I think so. At least I have enabled them and phpinfo says

Configuration
apache2handler
...
Loaded Modules: ... mod_proxy mod_proxy_html mod_proxy_http mod_proxy_wstunnel ...

I restart the apache after each config change.

Is there an easy way to test apache reverse proxy (independent from nextcloud)?

Try to use “http” instead of “https”, as stated in the setup script or in the documentation: GitHub - nextcloud/notify_push: Update notifications for nextcloud clients. AFAIK, there’s no need to change the URLs to https.

I try also http multiple times. But it is not working.

In order to test the ProxyPass or the target address respectively, I try it with the command

sudo curl -v http://127.0.0.1:7867

The result

* Expire in 0 ms for 6 (transfer 0x1851950)
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Expire in 200 ms for 4 (transfer 0x1851950)
* Connected to 127.0.0.1 (127.0.0.1) port 7867 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:7867
> User-Agent: curl/7.64.0
> Accept: */*
>
< HTTP/1.1 404 Not Found
< content-length: 0
< date: Tue, 03 Jan 2023 13:34:56 GMT
<
* Connection #0 to host 127.0.0.1 left intact

shows, that it can connected, but the target isn’t found. I hope, it is the right way to test it. …

Now I got it to work.

The solution is

ProxyPass /nextcloud/push/ws ws://127.0.0.1:7867/ws
ProxyPass /nextcloud/push/ https://127.0.0.1:7867/
ProxyPassReverse /nextcloud/push/ https://127.0.0.1:7867/

because my nextcloud is not at domain’s root, but on a subdirectory https://domain.xyz/nextcloud

2 Likes