Error 405 Method Not Allowed

Nextcloud version: 20
Operating system and version : Synology DSM 6.2.3
HAProxy Docker:latest

My Nextcloud installation runs smoothly behind a HAProxy setup that redirects to https. I can use my nextcloud within the local network with the local IP and outside with a dyndns adress.
However, is recently tried to connect my nextcloud account with an app to synchronize data. In the app (called Docutain, a smartphone scanner app) I received the following error:

OPTIONS /login ERROR 405 Method Not Allowed

In the mentioned app I try to connect to:

https://my-nextcloud-domain.com

I also tried

http://my-nextcloud-domain.com

and even

http://192.168.0.237:8080

Here is my config.php file:

<?PHP
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => '123id123',
  'passwordsalt' => 'xyzpasswordxyz',
  'secret' => 'xyzsecretxyz',
  'trusted_domains' =>
  array (
    0 => 'my-nextcloud-domain.com',
    1 => '192.168.0.237:8080',
    3 => '192.168.0.237:81',
    4 => '172.17.0.1',
  ),

  'overwritehost' => 'my-nextcloud-domain.com',
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '20.0.5.2',
  'overwrite.cli.url' => 'http://192.168.0.237:8080',
  'dbname' => 'nextcloud',
  'dbhost' => '192.168.0.237:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'admin',
  'dbpassword' => 'adminpassword',
  'installed' => true,
  'loglevel' => 2,
  'maintenance' => false,
);

How could I solve this issue?

Im not sure what causes the issue you’re having but it seems likely something about your reverse proxy/ nc connection is setup incorrectly. Such errors give weird symptoms not always visible directly.

Im rather sure that your 'overwrite.cli.url' => is incorrect, it should point to the external adress (my-nextcloud-domain.com) not the internal ip. Having that incorrect will break a bunch of things.

Are you terminating ssl at haproxy or at nextcloud (apache or nginx)? If you are terminating ssl at haproxy your config is missing some things:

You need to add trusted proxy directory something like (just an example, please check what ips should be written there yourself):

'trusted_proxies' => 
  array (
    0 => '192.168.0.237', #or w/e the internal ip if the haproxy instance is
    1 => '127.0.0.1',
    2 => '::1',
  ),

and:

'overwriteprotocol' => 'https',

I dont think you should need that overwritehost => ... but that entry has always confused me.

Remember to send the X-Forwarded-For header (option forwardfor) in haproxy.

take a look at the docs regaring reverse proxy, and the nc/AIO docker setup also has some configs to find that might be helpful, and if i remember correcly there is an issue with example haproxy setup.