The polling url does not start with https despite the login url started with https

Hi,

[/details]

Nextcloud version (eg, 20.0.5): 23.0.3.2
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04 + k3s 1.22.7
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.53
PHP version (eg, 7.4): 8.0.17

The issue you are facing: I’ve installed Nextcloud on my baremetal k3s server. I can connect and use it via web browser. DAVx5 connect to card/cal repos.
Desktop or mobile apps can’t connect it. Nextcloud appimage says:
“The polling url does not start with https despite the login url started with https. Login will not be possible because this might be a security issue.”

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

Steps to replicate it:

  1. https://domain.ltd

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

  'trusted_domains' => 
  array (
    0 => 'domain.ltd',
  ),

  'overwrite.cli.url' => 'http://localhost',

How can I solve this problem? Thanks in advance.

2 Likes

Hi,
I found a solution after digging a lot on internet.
Following changes solve the problem.

  'trusted_domains' => 
  array (
    0 => 'domain.ltd',
  ),

  'overwrite.cli.url' => 'https://domain.ltd',
  'overwriteprotocol' => 'https',

NC works as expected now on k3s cluster.

16 Likes

Hello i have the same problem, just that i do not have yet the technical knowledge to fix it

I’ve come back here for this solution multiple times, haha. THANK YOU!

Well, that solved a real headache for me, thanks a LOOOTTTTT

worked like a charm. Thanks!

This worked a treat thanks for your help!.
I can now access the nextcloud on desktop and Android mobile app but do you have any idea on how I can the nextcloud from my local IP address aswell? I can’t seem to access nextcloud on my home nework with nextclouds local IP and port number when accessing ip:port in a browser it gets redirected to https which throws an ERR_SSL_PROTOCOL_ERROR.

1 Like

Also worked like a charm for me.
Unfortunately I have the same new “Problem” now due to this change.
I can somehow still use the local IP address for the next cloud desktop client to sync my data, but not in the browser.

Worked like a charm. Thanks!

Huzzah! Thank you.

It’s work. Thanks you.

If you don’t like modifying the config files (I find it messy), then there are also env vars you can override. From my docker-compose.yaml file:

      - NEXTCLOUD_TRUSTED_DOMAINS=domain.ltd
      - OVERWRITECLIURL=https://domain.ltd
      - OVERWRITEPROTOCOL=https
      - OVERWRITEHOST=domain.ltd

I found these env vars by exec-ing into the nextcloud container and I found a config/reverse-proxy.config.php file:

# cat config/reverse-proxy.config.php
<?php
$overwriteHost = getenv('OVERWRITEHOST');
if ($overwriteHost) {
  $CONFIG['overwritehost'] = $overwriteHost;
}

$overwriteProtocol = getenv('OVERWRITEPROTOCOL');
if ($overwriteProtocol) {
  $CONFIG['overwriteprotocol'] = $overwriteProtocol;
}

$overwriteCliUrl = getenv('OVERWRITECLIURL');
if ($overwriteCliUrl) {
  $CONFIG['overwrite.cli.url'] = $overwriteCliUrl;
}

$overwriteWebRoot = getenv('OVERWRITEWEBROOT');
if ($overwriteWebRoot) {
  $CONFIG['overwritewebroot'] = $overwriteWebRoot;
}

$overwriteCondAddr = getenv('OVERWRITECONDADDR');
if ($overwriteCondAddr) {
  $CONFIG['overwritecondaddr'] = $overwriteCondAddr;
}

$trustedProxies = getenv('TRUSTED_PROXIES');
if ($trustedProxies) {
  $CONFIG['trusted_proxies'] = array_filter(array_map('trim', explode(' ', $trustedProxies)));
}

Working! Thank you.

Excellent, still working after years and despite many changes at NC.

Thanks a lot!

Worked for me, thanks. To anyone confused, you don’t need to change the above script at all. Just copy and paste it below your trusted domains like he has it in the solution.