502 Bad Gateway after updating to nextcloud AIO v9.5.1

I’m getting 502 Bad Gateway after updating Nextcloud AIO to v9.5.1.
Before the update, evertything worked fine. I cannot see any errors logged in the nexctloud/apache logs of the AIO interface.

This is my compose file for Nextcloud AIO:

volumes:
  nextcloud_aio_mastercontainer:
    name: nextcloud_aio_mastercontainer # This line is not allowed to be changed

services:
  nextcloud:
    image: nextcloud/all-in-one:latest # Must be changed to 'nextcloud/all-in-one:latest-arm64' when used with an arm64 CPU
    restart: always
    container_name: nextcloud-aio-mastercontainer # This line is not allowed to be changed
    volumes:
      - nextcloud_aio_mastercontainer:/mnt/docker-aio-config # This line is not allowed to be changed
      - /var/run/docker.sock:/var/run/docker.sock:ro # May be changed on macOS, Windows or docker rootless. See the applicable documentation
    ports:
      - 8080:8080
    environment: # Is needed when using any of the options below
      - APACHE_PORT=11000 # Is needed when running behind a reverse proxy. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      - APACHE_IP_BINDING=127.0.0.1 # Should be set when running behind a reverse proxy that is running on the same host. See https://github.com/nextcloud/all-in-one/blob/main/reverse-proxy.md
      - NEXTCLOUD_DATADIR=/srv-data/main/data/nextcloud-aio/data # Allows to set the host directory for Nextcloud's datadir. See https://github.com/nextcloud/all-in-one#how-to-change-the-default-location-of-nextclouds-datadir
      - DISABLE_BACKUP_SECTION=true # Setting this to true allows to hide the backup section in the AIO interface.

I have Caddy as a reverse proxy in another compose file:

services:
  caddy:
    image: caddy:latest
    container_name: caddy_proxy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "443:443/udp"
    volumes:
      - $PWD/Caddyfile:/etc/caddy/Caddyfile
      - $PWD/sites:/srv
      - $PWD/caddy_data:/data
      - $PWD/caddy_config:/config
    extra_hosts:
      - "host.docker.internal:host-gateway"

And this is part of my Caddyfile:

https://nc.mydomain.tld:443 {
        reverse_proxy host.docker.internal:11000
}

Output of curl -v http://localhost:11000 on my server:

*   Trying 127.0.0.1:11000...
* Connected to localhost (127.0.0.1) port 11000 (#0)
> GET / HTTP/1.1
> Host: localhost:11000
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< Content-Length: 0
< Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-bGtTdjhFVHJXRzhrSVRjUWlvUGswbktzZEM4SkV3ZWVQMFMrWVhPMVV2ND06cnlmZXN3VzlIbDFYWWxsYTNPdlV1QUhoUlJkaVVFRHJlUjc4SkNLYU1Lbz0='; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *; object-src 'none'; base-uri 'self';
< Content-Type: text/html; charset=UTF-8
< Date: Sat, 21 Sep 2024 10:41:34 GMT
< Location: https://nc.mydomain.tld/login
< Referrer-Policy: no-referrer
< Set-Cookie: oc_sessionPassphrase=xgwb9DAtNHpXwSbWpkqIrKEsGHQCeX99j5jGGDDAJkWMT7eIwkgo6Iu7hqqTww2glBlJmYK4wZ4BJJQzxW%2BrPE7U5XNdF3iUGdhhBPWVt%2Bu5ZAtQWqsSrnV6KqrLXYIP; path=/; secure; HttpOnly; SameSite=Lax
< Set-Cookie: __Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax
< Set-Cookie: __Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict
< Set-Cookie: oc1fguatzjkx=2a704ac5b60f26e77c2ec51ce170d322; path=/; secure; HttpOnly; SameSite=Lax
< Strict-Transport-Security: max-age=31536000;
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Permitted-Cross-Domain-Policies: none
< X-Robots-Tag: noindex, nofollow
< X-Xss-Protection: 1; mode=block
<
* Connection #0 to host localhost left intact

Output of docker inspect nextcloud-aio:

[
    {
        "Name": "nextcloud-aio",
        "Id": "880f4f1058275759b976a6abd7a417c6050b062b36dc93a292d26f7485cf5b0b",
        "Created": "2022-11-16T10:30:20.108682774+01:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.29.0.0/16",
                    "Gateway": "172.29.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {
            "1ae6d6a0b60d7ed35d7d7e9030030d6dab70a99765bdff3eee8d3014be8aa373": {
                "Name": "nextcloud-aio-mastercontainer",
                "EndpointID": "cb068a9aca148b8e63d9546821a629889bc878c6a226ecb329e4b3d8c1337fc0",
                "MacAddress": "02:42:ac:1d:00:03",
                "IPv4Address": "172.29.0.3/16",
                "IPv6Address": ""
            },
            "21c9804bf95ca09cdca79815a108e9e544857df15e22e4c1f7f56b2e00899de4": {
                "Name": "nextcloud-aio-apache",
                "EndpointID": "e24589750e94d644cf084b8f262d088cd54fee125d3a00cf6c8dfcdf4ff6583d",
                "MacAddress": "02:42:ac:1d:00:0c",
                "IPv4Address": "172.29.0.12/16",
                "IPv6Address": ""
            },
            "5680561531b9d281d3896794c9a5f8ea74bdf0d6bcea8a9afc6eea4cb676db88": {
                "Name": "nextcloud-aio-docker-socket-proxy",
                "EndpointID": "5feba53e0677562e7061352c1de784fce2aadd138ab03008ccba3d271209c6c7",
                "MacAddress": "02:42:ac:1d:00:09",
                "IPv4Address": "172.29.0.9/16",
                "IPv6Address": ""
            },
            "59a12c88bc81c0992a3e4607aa8dee195ea0330725ce5ebdbed47a9d9c0ee583": {
                "Name": "nextcloud-aio-notify-push",
                "EndpointID": "4f6f58b59f99008543754d1856bc5fc7ce47caa08fb7a0d6f9bddf0bdc90f4f5",
                "MacAddress": "02:42:ac:1d:00:0b",
                "IPv4Address": "172.29.0.11/16",
                "IPv6Address": ""
            },
            "75ceee47d8235ee2fb1e4971b5ebb62c0b391ae4334aef036480858644dcadce": {
                "Name": "nextcloud-aio-collabora",
                "EndpointID": "5b2f34bd7357e8df1d10a46e2e21632b9d297a959651e3dfa1006fd9ef665bb2",
                "MacAddress": "02:42:ac:1d:00:02",
                "IPv4Address": "172.29.0.2/16",
                "IPv6Address": ""
            },
            "76b3e9544a10b4d2be8235f7cbee121707850c09b89e3358f82a81b14c5b6510": {
                "Name": "nextcloud-aio-clamav",
                "EndpointID": "96610a28b17c878dc865f1d195d16ee3d8a07b34c8b0334c2121cadb968ce722",
                "MacAddress": "02:42:ac:1d:00:06",
                "IPv4Address": "172.29.0.6/16",
                "IPv6Address": ""
            },
            "af43dcd04764bbff13e7ee38425686a82f4abf638cc6ecec2667f0bc03fb73c1": {
                "Name": "nextcloud-aio-database",
                "EndpointID": "186c1b1a718c4cd49a489dd1da8eb4de33fcd3f5e0d0ea414340a37faa063c55",
                "MacAddress": "02:42:ac:1d:00:04",
                "IPv4Address": "172.29.0.4/16",
                "IPv6Address": ""
            },
            "b08f1ab5856d6d8149edf2035d1d61a49715aa662cb55f74c97b99b234fb878b": {
                "Name": "nextcloud-aio-nextcloud",
                "EndpointID": "bf5c44d84c04b49bf89e150973df0547803f53212f6831daf08395d072da19d8",
                "MacAddress": "02:42:ac:1d:00:0a",
                "IPv4Address": "172.29.0.10/16",
                "IPv6Address": ""
            },
            "bbe8bafc6364d4c5e2797b8a0b74531ca2dd3ca675706ded17133f634d7b76de": {
                "Name": "nextcloud-aio-redis",
                "EndpointID": "ec643c82785f4e65d49e3345c2a6c5bb385e37537a874bbaa5f300e22f8ab699",
                "MacAddress": "02:42:ac:1d:00:05",
                "IPv4Address": "172.29.0.5/16",
                "IPv6Address": ""
            },
            "bcb45789c80ed1f064e3803f5073b7f6dc217246e18f0718c5a17cc8b65093de": {
                "Name": "nextcloud-aio-fulltextsearch",
                "EndpointID": "ec2295118a7fc507700a8ba9d64f7ce854c754363ab3bd8e65cc59ec7aeb890a",
                "MacAddress": "02:42:ac:1d:00:07",
                "IPv4Address": "172.29.0.7/16",
                "IPv6Address": ""
            },
            "ef946c346041ecdce2681b9a75f4c51db9a3ca81682a675ecd482ca58c9ed25b": {
                "Name": "nextcloud-aio-imaginary",
                "EndpointID": "439f0100a82136cceba8af84e9d47ddf07a75b8b2791db01494a5a8e77f7bbdf",
                "MacAddress": "02:42:ac:1d:00:08",
                "IPv4Address": "172.29.0.8/16",
                "IPv6Address": ""
            }
        },
        "Options": {
            "com.docker.network.bridge.enable_icc": "true"
        },
        "Labels": {}
    }
]

If you’re not seeing any errors in the log you should wait few minutes. Sometimes it takes a while for the services to restart.