Nextcloud AIO returns 404 through reverse proxy while direct access with same headers works

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).

Experiencing an issue where Nextcloud AIO returns 404 through a reverse proxy while direct access with the same headers works perfectly.

Nextcloud Server version: Latest (via AIO)
Operating system and version: Nextcloud AIO on Unraid
Web server and version: Apache 2.4.65 (included with AIO), Caddy (included with AIO)
Reverse proxy and version: Pangolin 1.12.2 (custom reverse proxy on separate VM)
PHP version: Included with AIO
Is this the first time you’ve seen this error? No - it worked previously and then started failing
When did this problem seem to first start? Issue appears spontaneously after working correctly for extended periods
Installation method: AIO (All-in-One)
Are you using Cloudflare, mod_security, or similar? No

Summary of the issue

Nextcloud AIO is properly configured with reverse proxy mode enabled and domain set correctly. Direct access to the Apache port (11000) with the exact headers that the reverse proxy should be sending works perfectly. However, accessing through the reverse proxy returns 404 Not Found.

Important: Other services on the same Unraid server, proxied through the same reverse proxy, work correctly. Only Nextcloud returns 404.

Steps to replicate

  1. Configure Nextcloud AIO with reverse proxy mode enabled
  2. Set domain in AIO Master
  3. Configure reverse proxy to forward to Apache port 11000 with proper headers
  4. Access through reverse proxy - returns 404 Not Found
  5. Access directly with curl using same headers - works correctly

Testing Performed

Direct access to Apache port with proper headers (successful):

curl -v -H “Host: nextcloud.example.com” 
-H “X-Forwarded-For: 203.0.113.1” 
-H “X-Forwarded-Proto: https” 
-H “X-Forwarded-Host: nextcloud.example.com” 

http://192.168.1.100:11000

Response:

HTTP/1.1 302 Found
Location: https://nextcloud.example.com/login
Via: 1.1 Caddy
Set-Cookie: oc_sessionPassphrase=…; path=/; secure; HttpOnly; SameSite=Lax
Strict-Transport-Security: max-age=31536000;

This proves:

  • Nextcloud is running correctly
  • Apache is accessible on port 11000
  • Headers are being accepted properly
  • Domain is correctly configured
  • SSL redirect works

Through reverse proxy: 404 Not Found (no entries in Nextcloud logs)

Configuration

Nextcloud AIO Master settings:

  • Domain: nextcloud.example.com (properly configured)
  • Reverse Proxy Mode: Enabled
  • Apache Port: 11000

Reverse proxy configuration:

  • Target: http://192.168.1.100:11000
  • Headers being forwarded:
    X-Forwarded-Proto: https
    X-Forwarded-Host: nextcloud.example.com
    X-Forwarded-For: client-ip
  • SSL termination: At reverse proxy
  • Other services on same backend: Working correctly

Log entries

Nextcloud AIO Apache logs

[Fri Nov 21 16:05:43] [mpm_event:notice] [pid 42:tid 42] AH00489: Apache/2.4.65 (Unix) configured – resuming normal operations
[Fri Nov 21 16:05:43] [core:notice] [pid 42:tid 42] AH00094: Command line: ‘/usr/local/apache2/bin/httpd -D FOREGROUND’

Important: No entries appear in Apache logs when accessing through reverse proxy (despite 404 being returned). This suggests requests may not be reaching Nextcloud at all.

Nextcloud container startup logs

Connection to nextcloud-aio-apache (172.18.0.8) 11000 port \[tcp/\*\] succeeded!
System config value trusted_domains => 1 set to string nextcloud.example.com
System config value overwrite.cli.url set to string https://nextcloud.example.com/
System config value trusted_proxies => 10 set to string 172.18.0.0/16

All configuration appears correct.

Nextcloud config.php (relevant sections)

‘trusted_domains’ => [
  0 => ‘localhost’,
  1 => 'nextcloud.example.com',
],
‘trusted_proxies’ => [
  0 => ‘127.0.0.1’,
  1 => ‘::1’,
  10 => ‘172.18.0.0/16’,
],
‘overwrite.cli.url’ => ‘'https://nextcloud.example.com/’`,

Browser shows: “404 Not Found”

No console errors, no network errors - just a plain 404 response.

Key observations:

  1. Direct curl with identical headers works perfectly
  2. Access through reverse proxy returns 404
  3. Other services on same backend through same reverse proxy work
  4. No entries in Nextcloud/Apache logs when accessing through proxy
  5. Complete reinstall temporarily fixes issue, but it returns after hours

If headers were wrong, direct curl wouldn’t work. If reverse proxy mode was disabled, direct curl wouldn’t work. If domain was misconfigured, direct curl wouldn’t work. But direct curl does work with the exact headers the proxy sends.

Why would Nextcloud return 404 through a reverse proxy when:

  • Direct access with same headers works perfectly?
  • Reverse proxy mode is enabled?
  • Domain is properly configured?
  • trusted_proxies includes relevant networks?
  • Most importantly: Apache logs show no requests arriving when accessed through proxy?

Could there be some Nextcloud/Caddy internal routing or validation that rejects requests based on something other than headers? Some kind of connection validation that works for direct connections but fails for proxied ones?

Is that curl test from your Pangolin/RP VM?

What shows up in your Pangolin/RP log during the 404 events?

When did it start, precisely? Last week? Today? After an AIO upgrade? After something else maybe occurred? etc.

Yes, the curl test is from the Pangolin/RP VM. The connection works perfectly with proper headers when tested directly.

Regarding Pangolin/RP logs - that’s part of the mystery. The logs don’t show any errors during 404 events. Pangolin, Gerbil, and Traefik logs are all clean when the issue occurs. This makes debugging difficult since there’s nothing obviously wrong in the logs.

As for when it started - the issue began after I attempted to change the Nextcloud domain. The sequence was:

  1. Around November 17, I changed my domain in both Nextcloud AIO Master and Pangolin configuration
  2. It worked correctly for a few hours
  3. Then started returning 404 spontaneously
  4. Since then, I’ve reinstalled both Nextcloud AIO and Pangolin completely (clean installs)
  5. After reinstalls it works temporarily, then the 404 returns after several hours

I suspect something related to the domain change process may have left some configuration in an inconsistent state, but I can’t identify what. The fact that direct curl with proper headers works suggests Nextcloud itself is configured correctly, but something in the proxy chain is failing.

Other services on the same Unraid server through the same Pangolin instance continue working normally throughout this issue.

1 Like

This is indeed a Pangolin (reverse proxy) problem.
I spent several days trying to fix it, without success. I came across a post somewhere where someone else had the same problem with an older version, only with all resources. They recommended rolling back to 1.11.0, so I tried that, but I got an SQLite error, so I decided to do a clean install of the above version.
Nextcloud, which wasn’t working before, now works without any problems.

1 Like

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