NC connection wizard tries to access token endpoint via http instead of https

I have a working Nextcloud 18.0.3 installation on my synology server (OS: DSM 6.2.2-24922 Update 4) which is already connected to 3 clients including my smartphone. Now I would like to connect an additional Windows 10 Home 32 bit client
The browser access (like https://mydomain.de:12345) works fine from that machine.
When connecting with the connection wizard of nextcloud client (2.6.4 stable Win 32)
I see this error message.

    Fehler beim Zugriff auf den Token' -Endpunkt:
    Error transferring http://mydomain.de:12345/login/v2/poll - server replied: Bad Request

The wizard tries to use http instead of https. However my nextcloud server is not reachable via http from internet.
How to overcome the blockage?

REM 1: As a possible outcome I already had tried to find out how to rewrite http access to https on Nextcloud side, but my Google search was not successful here. Actually, for me that is not so important as the Nextcloud instance is for private use mainly. And as far as I remember there was a form in the earlier connection wizard where I could enter the correct URL with leading https://
REM 2: As I can access Nextcloud in my local network with http://192.168
:8090 I used this as a workaround. But obviously this is a local network solution only. Probably I could configure my router to forward the external requests to the http port, but that is not what I want due to security concerns.
Over all the token access via http could be a bug.

Ideally you have a redirect for https. Not sure why it doesn’t use https per default (and http as fall-back). The login-flow documentation uses https: https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html

You’ll probably have to ask the developers: https://github.com/nextcloud/desktop

Hi Tflidd
Thank you very much for your reply
I checked login-flow documentation chapter ‘Login flow v2’
https://docs.nextcloud.com/server/latest/developer_manual/client_apis/LoginFlow/index.html#login-flow-v2
That is all about https.
And in the German installation guide I used one year ago ( https://www.heise.de/ratgeber/Nextcloud-als-Docker-Instanz-im-NAS-einrichten-4199681.html ) I found this:
“Mit einem ReverseProxy-Eintrag im NAS leitet nginx HTTPS VerbindungswĂŒnsche an den Nextcloud Container weiter, der selbst nur HTTP spricht”
(“With a reverse proxy entry in the NAS, nginx forwards HTTPS connection requests to the NextCloud container, which itself only speaks HTTP”)
Probably this reverse proxy is misconfigured not the wizard.

Just started getting this today - no problems with android clients just Linux desktop clients. Suddenly becomes unusable. No other changes to networks that I am aware of.

Hi guys,

I just had a similar situation on my nextcloud docker (port 80) behind nginx proxy (serving https on non-standard 9876) and redirecting to nextcloud http:80 backend). In case your setup is similar, just add this to your nginx config:

proxy_set_header Host $http_host;
#I use this to prevent port change on redirect
#alternatively use the common
#proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#this preserves the initial protocol, the https


after reloading nginx the nextcloud-client obtained the token from https correctly.
I am logged in.

I still have the problem. Now on a Windows 10 Installation from the scratch.
Waiting for authorization is an endless story.
Error transferring http://my.domain.de:12348/login/v2/poll

I suppose that the setup fails if the http access - which is absolutely not recommended - is not configured and not possible. The setup is stuck then.
I tested nextcloud-3.0.1-setup and nextcloud-2.6.4-setup and both had the problem.

Finally I could find a workaround.
I found an older setup of 2018-07-03: Nextcloud-2.3.3.1-setup.exe
That Nextcloud-2.3.3.1-setup simply requests the URL (with https !!! ) and the credentials and worked perfectly within minutes.

Caution: After i had successfully established the connection and synchronized with my Nextcloud 19.0.2 I had the expectation that I can update to the current version but: The newer setups 2.6.4 and 3.0.1- started and requested the connection data similar to a virgin installation - starting the eternal loop “Waiting for authorization” with Error: “Transferring http:// 
” and waiting for armageddon 


In my scenario with a Docker container on a Synology NAS is it so, that the reverse proxy on DSM OS should also provide an automatic redirect of an http request to https. If that worked, the problem possibly would not occur. But again: the missing http redirect is not a problem for me. I simply type https and that’s it.
An optional http to https redirect should not block a client setup I think . So for me the behavior of the v2 is a bug.

I would like to add that I was able to set the value set “overwrite.cli.url” with occ ,
me@synodiskstation:~$ sudo docker exec -u www-data -it nextcloud1 /bin/bash
www-data@nextcloud1:~/html$ ./occ config:system:set “overwrite.cli.url” --value=“https:// my.domain.de:12348”
but unfortunately that did not change the issue and did not correct the wrong server address http in the server settings:


Well - currently I am using the client version 2.3.3 and it is working fine.

I do have exactly the same issue.
I couldn’t donwload version 2.3.3 so I tried with 2.5.0 but no luck.

If anyone could help here, this would be great!

Unfortunately I do not have a solution. I have to add the information that the current client Nextcloud-3.0.2-setup.exe was released 9 days ago and runs into to the same issue "BAd request " http://mydomain.de:12345/login/v2/
So I will try a ‘supposed bug report’ on github as [tflidd] proposes.

But are we the only one having this problem? That is strange! Did you made a bugreport? Could you post the link here? Thanks

so, finaly I managed to make it work.
I added ‘overwriteprotocol’ => ‘https’, to my config.php, et voilà! now I’m able to connect with my desktop client.

To remember I do run nextcloud into docker on my synology nas.

Thanks

Thank you Snowest for the hint.
I haven’t created an issue yet. I have the same scenario (nextcloud / docker / synology nas) and will try 'overwriteprotocol’ .

1 Like

Yes,let me know. It would be great if I could help someone. :wink:

Hi everyone,
I too had this same problem (proxy between client and server).
the ‘overwriteprotocol’ => ‘https’ together with the correct ‘overwrite.cli.url’ settings in config/config.php fixed everything!

Thank you

Hello guys!

I have the same problem, the desktop clients synchronize and arrive at a certain point and give the message ServerReplied: Bad Gateway

my config.php -> Screenshot by Lightshot

Centos7
NC 19
Nginx

I had the same problem with the message about token and error transferring https://my.nextcloud.instance/login/v2/poll bad request
I’m in a docker container beside traefik https proxy.
I used @Snowest and @Photubias information and all work fine now.

'overwriteprotocol' => 'https',
'overwrite.cli.url' => 'https://my.nextcloud.instance',

the overwriteprotocol, seems to be enough but the documentation gives information about all :
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html?highlight=overwrite%20cli%20url#proxy-configurations