Nextcloud cllient login using http rather than https for grant access

I have Nextcloud server running in container that is not auto-updating. My client is on Ubuntu 18.04 also not auto-updating.

For some reasons the client not wants to use http rather than https for grant access step. So it is no longer possible to use the client.

The clients that are connected still work but when a user logs out, it is not possible anymore to log in.

Steps:

  • Start client and select login.
  • The client redirects to the browser, I select log in.
  • I see “Grant Access” button
  • When I press the “Grant Access” button the browser shows a warning that the request will be send over an unencrypted connection
  • WHen I continue NextCloud shows an error - internal server error.

BTW when I login to NextCloud using browser - not client - everything works fine but when I look at the WebDAV settings it does show a link with http and not https
http://mynextcloudserver/docs/remote.php/webdav/

Nextcloud 16.0.4 docker deploy on Ubuntu 18.04
Client is 2.6.5-20200713.144448.adada8b2e-1.0~bionic1 on Ubuntu 18.04

The output of your Nextcloud log in Admin > Logging:

[index] Error: TypeError: Argument 1 passed to OC\Core\Controller\ClientFlowLoginV2Controller::grantPage() must be of the type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 166 at <<closure>>

0. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 166
   OC\Core\Controller\ClientFlowLoginV2Controller->grantPage(null)
1. /var/www/html/lib/private/AppFramework/Http/Dispatcher.php line 99
   OC\AppFramework\Http\Dispatcher->executeController(OC\Core\Controll ... {}, "grantPage")
2. /var/www/html/lib/private/AppFramework/App.php line 126
   OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Controll ... {}, "grantPage")
3. /var/www/html/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
   OC\AppFramework\App::main("OC\\Core\\Contr ... r", "grantPage", OC\AppFramework\ ... {}, {_route: "core.C ... "})
4. <<closure>>
   OC\AppFramework\Routing\RouteActionHandler->__invoke({_route: "core.C ... "})
5. /var/www/html/lib/private/Route/Router.php line 297
   undefinedundefinedcall_user_func(OC\AppFramework\ ... {}, {_route: "core.C ... "})
6. /var/www/html/lib/base.php line 975
   OC\Route\Router->match("/login/v2/grant")
7. /var/www/html/index.php line 42
   OC::handleRequest()

This problem was result of wrong trusted_proxies setting. The proxy ip changed because of a new reverse proxy server and this happended.

After changing trusted_proxies to correct ip address, it started working correctly again.