# Notify\_Push not able to connect to nextcloud

**URL:** <https://help.nextcloud.com/t/notify-push-not-able-to-connect-to-nextcloud/215026>\
**Category:** ℹ️ Support\
**Tags:** notify\_push, nc30, aio, dns\
**Created:** [January 15, 2025, 2:35pm UTC](https://help.nextcloud.com/t/notify-push-not-able-to-connect-to-nextcloud/215026 "2025-01-15T14:35:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![blicknix](https://help.nextcloud.com/letter_avatar/blicknix/32/6_22734026db12803ebb3e059622ac3534.png) [@blicknix](https://help.nextcloud.com/u/blicknix)\
**Post date:** [January 15, 2025, 2:35pm UTC](https://help.nextcloud.com/t/notify-push-not-able-to-connect-to-nextcloud/215026/1 "2025-01-15T14:35:00Z")

</div>

## The Basics

- Nextcloud Server version _(e.g., 29.x.x)_:
  - `30.0.2`

- Operating system and version _(e.g., Ubuntu 24.04)_:
  - `nomad Cluster`

- Web server and version _(e.g, Apache 2.4.25)_:
  - `nextcloud:30.0.2 image`

- Installation method _(e.g. AlO, NCP, Bare Metal/Archive, etc.)_
  - `Container`

- Are you using CloudfIare, mod\_security, or similar? _(Yes / No)_
  - `external load balancer`

### Summary of the issue you are facing:

Due to design, we build our container with the apps inside the container itself and not on a volume. Therefore, we use two different pods for the Nextcloud and the notify\_push servers without shared volume. Both are reachable through an external load balancer. Now we face the issue that we want to use notify\_push, mostly for push notifications with the Talk feature. While both services are reachable from outside and within, the push notify service is not able to reach the Nextcloud server during the self-test.

```auto
www-data@nextcloud:~/html$ php occ notify_push:setup https://next.cloud/push
✓ redis is configured
✓ push server is receiving redis messages
✓ push server can load mount info from database
🗴 push server can't connect to the Nextcloud server
  error sending request for url (https://next.cloud/index.php/apps/notify_push/test/cookie)

```

We can reach the nextcloud server through the provided url and curl from within the notify\_push pod and get back the cookie.  
For our setup we mostly used the AIO Deployments which minor changes to the nomad cluster and major changes due to the missing shared volumes.

Our main questions are right now if the issue we are facing has something to do with our design, so that both services (push and nextcloud) have to access the same binary and path, or if this is still a network error we have to troubleshoot?

#### Nextcloud

### Configuration

Our changed entrypoint script

```auto
 #!/bin/bash
export NOTIFY_PUSH_PATH="/usr/src/nextcloud/apps/notify_push/bin/x86_64/notify_push"

if [-z "$NEXTCLOUD_HOST"]; then
    echo "NEXTCLOUD_HOST needs to be provided. Exiting!"
    exit 1
elif [-z "$POSTGRES_HOST"]; then
    echo "POSTGRES_HOST needs to be provided. Exiting!"
    exit 1
elif [-z "$REDIS_HOST"]; then
    echo "REDIS_HOST needs to be provided. Exiting!"
    exit 1
fi

# Only start container if nextcloud is accessible
while ! nc -z "$NEXTCLOUD_HOST" 443; do
    echo "Waiting for Nextcloud to start..."
    sleep 5
done

# Funktion, um Sonderzeichen im Passwort zu URL-encodieren
url_encode_password() {
    local raw_password="$1"
    local encoded_password=""
    local char

    # Gehe jedes Zeichen im Passwort durch und kodieren, falls notwendig
    for (( i=0; i<${#raw_password}; i++ )); do
        char="${raw_password:i:1}"

        case "$char" in
            [a-zA-Z0-9] )
                # alphanumerische Zeichen bleiben unverändert
                encoded_password+="$char"
                ;;
            " " )
                # Leerzeichen werden zu '%20'
                encoded_password+="%20"
                ;;
            "!" )
                encoded_password+="%21"
                ;;
            "\"" )
                encoded_password+="%22"
                ;;
            "#" )
                encoded_password+="%23"
                ;;
            "$" )
                encoded_password+="%24"
                ;;
            "%" )
                encoded_password+="%25"
                ;;
            "&" )
                encoded_password+="%26"
                ;;
            "'" )
                encoded_password+="%27"
                ;;
            "(" )
                encoded_password+="%28"
                ;;
            ")" )
                encoded_password+="%29"
                ;;
            "*" )
                encoded_password+="%2A"
                ;;
            "+" )
                encoded_password+="%2B"
                ;;
            "," )
                encoded_password+="%2C"
                ;;
            "/" )
                encoded_password+="%2F"
                ;;
            ":" )
                encoded_password+="%3A"
                ;;
            ";" )
                encoded_password+="%3B"
                ;;
            "<" )
                encoded_password+="%3C"
                ;;
            "=" )
                encoded_password+="%3D"
                ;;
            ">" )
                encoded_password+="%3E"
                ;;
            "?" )
                encoded_password+="%3F"
                ;;
            "@" )
                encoded_password+="%40"
                ;;
            "[" )
                encoded_password+="%5B"
                ;;
            "\\" )
                encoded_password+="%5C"
                ;;
            "]" )
                encoded_password+="%5D"
                ;;
            "^" )
                encoded_password+="%5E"
                ;;
            "_" )
                encoded_password+="%5F"
                ;;
            "{" )
                encoded_password+="%7B"
                ;;
            "|" )
                encoded_password+="%7C"
                ;;
            "}" )
                encoded_password+="%7D"
                ;;
            "~" )
                encoded_password+="%7E"
                ;;
            * )
                # Alle anderen Zeichen werden ebenfalls durch %HEX ersetzt
                encoded_password+=$(printf '%%%02X' "'$char")
                ;;
        esac
    done

    echo "$encoded_password"
}

POSTGRES_PASSWORD=$(url_encode_password "$POSTGRES_PASSWORD")

# Correctly set CPU_ARCH for notify_push
CPU_ARCH="$(uname -m)"
export CPU_ARCH
if [-z "$CPU_ARCH"]; then
    echo "Could not get processor architecture. Exiting."
    exit 1
elif ["$CPU_ARCH" != "x86_64"]; then
    export CPU_ARCH="aarch64"
fi

# Add warning
if ! [-f $NOTIFY_PUSH_PATH]; then
    echo "The notify_push binary was not found."
    echo "Most likely is DNS resolution not working correctly."
    echo "You can try to fix this by configuring a DNS server globally in dockers daemon.json."
    echo "See https://dockerlabs.collabnix.com/intermediate/networking/Configuring_DNS.html"
    echo "Afterwards a restart of docker should automatically resolve this."
    echo "Additionally, make sure to disable VPN software that might be running on your server"
    echo "Also check your firewall if it blocks connections to github"
    echo "If it should still not work afterwards, feel free to create a new thread at https://github.com/nextcloud/all-in-one/discussions/new?category=questions and post the Nextcloud container logs there."
    echo ""
    echo ""
    exit 1
fi

echo "notify-push was started"

# Set a default value for POSTGRES_PORT
if [-z "$POSTGRES_PORT"]; then
    POSTGRES_PORT=5432
fi
# Set a default for redis db index
if [-z "$REDIS_DB_INDEX"]; then
    REDIS_DB_INDEX=0
fi
# Set a default for db type
if [-z "$DATABASE_TYPE"]; then
    DATABASE_TYPE=postgres
elif ["$DATABASE_TYPE" != postgres] && ["$DATABASE_TYPE" != mysql]; then
    echo "DB type must be either postgres or mysql"
    exit 1
fi

# Set sensitive values as env
export DATABASE_URL="$DATABASE_TYPE://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB"
export REDIS_URL="redis://:$REDIS_HOST_PASSWORD@$REDIS_HOST:$NOMAD_HOST_PORT_db/$REDIS_DB_INDEX"

echo $NOTIFY_PUSH_PATH
# Run it
$NOTIFY_PUSH_PATH \
    --database-prefix="oc_" \
    --nextcloud-url "https://$NC_DOMAIN" \
    --port 7867

```

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [January 15, 2025, 4:50pm UTC](https://help.nextcloud.com/t/notify-push-not-able-to-connect-to-nextcloud/215026/2 "2025-01-15T16:50:03Z")

</div>

I have no explanation given your statement is true:

> [@blicknix](#):
>
> We can reach the nextcloud server through the provided url and curl from within the notify\_push pod and get back the cookie.

but I’m still under impression you experience some networking issue. Maybe this helps: [Setting up Files (High Performance Backend) - #10 by wwe](https://help.nextcloud.com/t/setting-up-files-high-performance-backend/108651/10) you didn’t mention so I’m guessing - review if the ` /push` URL is routed to the notify\_push container and not to the app…

---

<div class="post-metadata">

**Author:** ![jtr](https://help.nextcloud.com/letter_avatar/jtr/32/6_22734026db12803ebb3e059622ac3534.png) [@jtr](https://help.nextcloud.com/u/jtr)\
**Post date:** [January 15, 2025, 11:24pm UTC](https://help.nextcloud.com/t/notify-push-not-able-to-connect-to-nextcloud/215026/3 "2025-01-15T23:24:30Z")

</div>

So this:

> `error sending request for url (https://next.cloud/index.php/apps/notify_push/test/cookie)`

…is the literal body received back from querying this URL:

`https://next.cloud/index.php/apps/notify_push/test/reverse_cookie` ← this is the URL that test that you’re seeing fail in `setup` is querying

(Yes, it’s a little confusing).

You might try:

- querying that URL rather than the one in the output (though it’s notable it’s working)
- bumping up logging: [GitHub - nextcloud/notify\_push: Update notifications for nextcloud clients](https://github.com/nextcloud/notify_push/tree/main?tab=readme-ov-file#logging)

---

<div class="post-metadata">

**Author:** ![blicknix](https://help.nextcloud.com/letter_avatar/blicknix/32/6_22734026db12803ebb3e059622ac3534.png) [@blicknix](https://help.nextcloud.com/u/blicknix)\
**Post date:** [January 24, 2025, 4:11pm UTC](https://help.nextcloud.com/t/notify-push-not-able-to-connect-to-nextcloud/215026/4 "2025-01-24T16:11:39Z")

</div>

Thanks, found the error. It was actually an SSL Handshake error due to a http proxy used.

```auto
        SSL_CERT_DIR = "/etc/ssl/certs"
	NO_PROXY = "NEXTCLOUD URL"

```

These variables for the notify\_push did the trick.

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [February 1, 2025, 4:12pm UTC](https://help.nextcloud.com/t/notify-push-not-able-to-connect-to-nextcloud/215026/5 "2025-02-01T16:12:35Z")

</div>

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.
