notify_push behind two nginx

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. :heart:

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 32.0.1
  • Operating system and version (e.g., Ubuntu 24.04):
    • Debian Trixie
  • Web server and version (e.g, Apache 2.4.25):
    • nginx 1.26.3
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • nginx 1.22.1
  • PHP version (e.g, 8.3):
    • 8.4
  • Is this the first time you’ve seen this error? (Yes / No):
    • yes
  • When did this problem seem to first start?
    • when setting up notify_push
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • manual
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • no

Summary of the issue you are facing:

My Setup is the following:

internet <---> nginx reverse proxy <----> nginx host <----> nextcloud
                                                        \-> notify_push

On the nginx host, I added the following lines - according to notify_push documentation:

    location ^~ /push/ {
        proxy_pass http://127.0.0.1:7867/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

However, to make notify_push work correctly from the outside, I also had to change the reverse proxy like this:

        location / {
                proxy_pass http://10.0.0.1;
                include /etc/nginx/proxy_params;
                client_max_body_size 0;
                proxy_connect_timeout  3600s;
                proxy_read_timeout  3600s;
                proxy_send_timeout  3600s;
                send_timeout  3600s;
                proxy_request_buffering off;

                # XXX: notify_push
                proxy_set_header Upgrade $http_upgrade;
        }

Without proxy_set_header Upgrade $http_upgrade, it would not connect. However, the nextcloud documentation specifically says to hide this header for mobile devices. Thus, do I need to create a specific location block just for /push/?

It looks like, the intended workflow is to expose notify_push on the host (in my case 10.0.0.1) and have the /push configuration on the reverse proxy, like this:

internet <---> nginx reverse proxy <----> nginx host <----> nextcloud
                                      \-------------------> notify_push

However, I think it is a better solution to have reverse proxy not know about specifics (as long as it is possible), so it is easier to swap it or even remove it if necessary.

Thus, what is the correct setting on the reverse proxy? Can I leave it like it is? Do I need to add a location block just for /push?

Steps to replicate it (hint: details matter!):

  1. remove the line with Upgrade

  2. notify_push does not work