Trusted_proxies not applied?

Nextcloud version (eg, 20.0.5): 22.1.1.2
Operating system and version (eg, Ubuntu 20.04): Raspberry Pi OS (Buster 10.10)
Docker image: 22-apache
Apache version: 2.4.48 (in docker image)
PHP version (eg, 7.4): 8.0.10 (in docker image)
Behind a Nging proxy using nginxproxymanager

The issue you are facing:

The main visible issues is that most of my requests end with error code 408 (timeout).
After digging in, I found out that I did not declare my proxy in the configuration (I don’t know if this is the root cause, but still…). So I added the following configuration in the nextcloud config file:

  'trusted_proxies' =>
  array (
    0 => 'nging-proxy-manager-app',
    1 => '172.23.0.0/16',
  ),

But, after restarting the Nextcloud container, I checked that this configuration was indeed applied in remoteip.conf:

$ docker exec -it e2d70864e907 cat /etc/apache2/conf-enabled/remoteip.conf                                                              
RemoteIPHeader X-Real-IP
RemoteIPTrustedProxy 10.0.0.0/8
RemoteIPTrustedProxy 172.16.0.0/12
RemoteIPTrustedProxy 192.168.0.0/16

I see two issues:

  • RemoteIPTrustedProxy is not updated according to my nextcloud configuration.
  • RemoteIPHeader is not X-Forwarded-For, as it is described in this documentation section

I would like to know if I’m missing something or if this seems like an actual bug.

Is this the first time you’ve seen this error? (Y/N): Y

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php                                                                                                                                                                    
$CONFIG = array (                                                                                                                                                        
  'instanceid' => '<hidden>',                                                                                                                                        
  'passwordsalt' => '<hidden>',                                                                                                                    
  'secret' => '<hidden>',                                                                                                        
  'trusted_domains' =>                                                                                                                                                   
  array (                                                                                                                                                                
  <hidden>
  ),                                                                                                                                                                     
  'default_phone_region' => 'FR',                                                                                                                                        
  'datadirectory' => '/var/www/html/data',                                                                                                                               
  'dbtype' => 'mysql',                                                                                                                                                   
  'version' => '22.1.1.2',                                                                                                                                               
  'installed' => true,                                                                                                                                                   
  'maintenance' => false,                                                                                                                                                
  'theme' => '',                                                                                                                                                         
  'loglevel' => 0,                                                                                                                                                       
  'log_type' => 'file',                                                                                                                                                  
  'mail_smtpmode' => 'smtp',                                                                                                                                             
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'cloud',
  'mail_domain' => '<hidden>',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '<hidden>',
  'mail_smtpport' => '465',
  'mail_smtpname' => '<hidden>',
  'mail_smtppassword' => '<hidden>',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'updater.secret' => '<hidden>',
  'dbname' => '<hidden>',
  'dbhost' => '<hidden>',
  'dbuser' => '<hidden>',
  'dbpassword' => '<hidden>',
  'mysql.utf8mb4' => true,
  'overwrite.cli.url' => '<hidden>',
  'overwriteprotocol' => 'https',
  'trashbin_retention_obligation' => 'auto, 90',
  'music.lastfm_api_key' => '<hidden>',
  'app_install_overwrite' => 
  array (
    0 => 'music',
  ),
  'trusted_proxies' =>
  array (
    0 => 'nging-proxy-manager-app',
    1 => '172.23.0.0/16',
  ),
);

The output of your Apache/nginx/system log in /var/log/____:

in my Docker container, I don’t have any log of apache, I don’t know why…