nextcloud / nextcloud/notify_push

Localhost proxy setup not working according to setup wizard

Open
#585 3 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
344
Forks
64
Avg merge
2d 10h
Merged PRs (30d)
5

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce
  1. Setup systemd service and enable/start program
  2. Configure reverse proxy in Apache and restart Apache
  3. Enable app and start occ notify_push:setup <url>
Expected behaviour

It should work

Actual behaviour
occ notify_push:setup <url>
✓ redis is configured
✓ push server is receiving redis messages
✓ push server can load mount info from database
✓ push server can connect to the Nextcloud server
🗴 push server is not a trusted proxy by Nextcloud or another proxy in the chain.
  Nextcloud resolved the following client address for the test request: "<external ipv6>" instead of the expected "1.2.3.4" test value.
  The following trusted proxies are currently configured: "127.0.0.1", "::1"
  The following x-forwarded-for header was received by Nextcloud: "1.2.3.4"
    from the following remote: <external ipv6>

  <external ipv6> is not a trusted as a reverse proxy by Nextcloud
  See https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html#defining-trusted-proxies for how to add trusted proxies.

  If you're having issues getting the trusted proxy setup working, you can try bypassing any existing reverse proxy
  in your setup by setting the `NEXTCLOUD_URL` environment variable to point directly to the internal Nextcloud webserver url
  (You will still need the ip address of the push server added as trusted proxy)

Now searching through similar issues, i learned that the test is basically:

curl -H 'x-forwarded-for: 1.2.3.4' https://<url>/index.php/apps/notify_push/test/remote

And that returns my external IPv6.

What works:

curl --interface localhost -H 'x-forwarded-for: 1.2.3.4' https://<url>/index.php/apps/notify_push/test/remote
1.2.3.4

So it should work if the source address is actually localhost.

Now:

occ notify_push:self-test
no push server configured

Not sure how to check if it is actually working, i tried to raise the log level but nothing in the Nextcloud log nor journalctl. I assume the app logs into the Nextcloud log.

My config.php has:

'trusted_proxies' =>
  array (
    0 => '127.0.0.1',
    1 => '::1',
  ),

Apache config has the proxy config from the README in my Nextcloud vhost:

    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/

No other proxies involved.

Systemd Unit is from Arch Linux pkg:

systemctl cat nextcloud-app-notify_push
# /usr/lib/systemd/system/nextcloud-app-notify_push.service
[Unit]
Description = Push daemon for Nextcloud clients

[Service]
Environment = PORT=7867 BIND=127.0.0.1
ExecStart = /usr/share/webapps/nextcloud/apps/notify_push/bin/x86_64/notify_push /etc/webapps/nextcloud/config/config.php
User = nextcloud

[Install]
WantedBy = multi-user.target
Server configuration

Web server: Apache

Database: PostgreSQL

PHP version: 8.2

Nextcloud version: 31.0.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the occ notify_push:setup <url> flow and the /index.php/apps/notify_push/test/remote endpoint, reproducing the request with the shown curl command. Review the Apache ProxyPass configuration and the systemd unit for the proxy source address. Done means the setup wizard correctly accepts the configured localhost proxy, or clearly reports the required configuration when it cannot.

Written by the indexing model from the issue text.

Assessment

Tech stack
apache, php, postgresql, rust
Domain
backend, devops, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.