nextcloud / ios

📱 Nextcloud iOS App
https://itunes.apple.com/us/app/nextcloud/id1125420102
GNU General Public License v3.0
1.94k stars 876 forks source link

App login forces /nextcloud in one GET request, resulting in a 404 #1471

Open Keyaku opened 3 years ago

Keyaku commented 3 years ago

Expected behaviour

The app should successfully log in and open the directory screen by respecting the server's configurations.

Actual behaviour

The app makes a GET request with /nextcloud, resulting in a 404 Not Found.

This is what shows up on Apache's acess.log:

1.1.1.1 - - [31/Oct/2020:16:51:34 +0000] "POST /index.php/login HTTP/1.1" 303 6088 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/3.0.11"
1.1.1.1 - - [31/Oct/2020:16:51:36 +0000] "GET /nextcloud/index.php/login/flow/grant?clientIdentifier=&stateToken=TOKEN HTTP/1.1" 404 5363 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/3.0.11"

Steps to reproduce

  1. Fill server URL; in my case, cloud.mydomain.com
  2. Login from new or first account
  3. Not Found

Reasoning or why should it be changed/implemented?

This wasn't a problem before I got a Wildcard certificate, since I was using domain.com/nextcloud as the URL. However, I'm now using cloud.domain.com, and so I conclude that this is either a bug or hacked code to force it to use /nextcloud since nowhere in my setup (at least to my knowledge) do I have a configuration that uses /nextcloud as rewrite base.

It doesn't happen anywhere else. Desktop browsers (Safari, Firefox and a Chromium-based) and iOS Safari all work as intended.

iOS version

14.1

App version

3.0.11

Server configuration

Running through reverse proxy (Raspberry Pi passing to a WSL setup).

Operating system: WSL Debian

Web server: Apache

Database: MariaDB

PHP version: 7.3

Nextcloud version: 19.0.4.2

castillo92 commented 3 years ago

I have the same issue, do you have your instance behind a proxy reverse?

iOS app: 3.1.0 Nextcloud: 20.0.4

This problem unable to login with the standar metod. I must to use the legacy loging to use the app.

192.168.1.61 - - [20/Dec/2020:00:22:17 +0100] "POST /nextcloud/login HTTP/1.1" 303 1310 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/3.1.0"
192.168.1.61 - - [20/Dec/2020:00:22:17 +0100] "GET /nextcloud/nextcloud/login/flow/grant?clientIdentifier=&stateToken=P1iwRwLsEVBX4GhKcdBv9rpFJV3C1EVjzCgXqMZ1bfoRxIPZJDdVXtuUPMl8X5Ej HTTP/1.1" 302 914 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/3.1.0"
castillo92 commented 3 years ago

Today changing this directive I could check it have impact in the URL:

nextcloud/config/config.php

'overwritewebroot' => '/',

It seems when server reply to iOS app, it ignore this directive, duplicating the "/nextcloud" in the URL

emanteuf commented 2 years ago

Is this ever going to be fixed or will there be some guidance on how to fix it? I've also had this problem for a year now and I'm not sure if your comments @castillo92 are supposed to tell us how to fix the issue or if you were just making an observation as the start of your troubleshooting process.

castillo92 commented 2 years ago

me guidance

I think it is an issue to be fixed, but changing some parameters in the proxy reverse and nextcloud.conf is enought.

We also need to improve the documentation.

If you need the good config I can share it.

lazywebm commented 2 years ago

If you need the good config I can share it.

@castillo92 yes, please.

castillo92 commented 2 years ago

If you need the good config I can share it.

@castillo92 yes, please.

My config.php is:

sudo nano /var/www/nextcloud/config/config.php

<?php
$CONFIG = array (
  'passwordsalt' => 'SECRET',
  'secret' => 'SECRET',
  'trusted_domains' => 
  array (
    0 => '192.168.1.*',
    1 => 'MY_DOMAIN.com',
    2 => 'SUB_DOMAIN.MY_DOMAIN.com',
  ),
  'datadirectory' => '/mnt/HDD1/NC_data',
  'dbtype' => 'mysql',
  'version' => '24.0.2.1',
  'dbname' => 'nextcloudDB',
  'dbhost' => 'IP_SQL_SERVER:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'SECRET',
  'dbpassword' => 'SECRET',
  'installed' => true,
  'instanceid' => 'SECRET',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/var/run/redis/redis-server.sock',
    'port' => 0,
    'timeout' => 1.0,
  ),
  'blacklisted_files' => 
  array (
    0 => '.htaccess',
    1 => 'Thumbs.db',
    2 => 'thumbs.db',
    3 => 'prohib.ido',
  ),
  'loglevel' => 0,
  'log_rotate_size' => 3145728,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpsecure' => 'ssl',
  'mail_from_address' => 'SECRET',
  'mail_domain' => 'gmail.com',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '465',
  'mail_smtpname' => 'SECRET@gmail.com',
  'mail_smtppassword' => 'SECRET',
  'enable_previews' => true,
  'preview_max_x' => 1000,
  'preview_max_y' => 1000,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\PDF',
    3 => 'OC\\Preview\\MSOfficeDoc',
    4 => 'OC\\Preview\\JPEG',
    5 => 'OC\\Preview\\PNG',
    6 => 'OC\\Preview\\GIF',
    7 => 'OC\\Preview\\BMP',
    8 => 'OC\\Preview\\XBitmap',
    9 => 'OC\\Preview\\MP3',
    10 => 'OC\\Preview\\HEIC',
    11 => 'OC\\Preview\\Movie',
    12 => 'OC\\Preview\\MKV',
    13 => 'OC\\Preview\\MP4',
    14 => 'OC\\Preview\\AVI',
    15 => 'OC\\Preview\\MOV',
  ),
  'overwrite.cli.url' => 'https://MY_SUBDOMAIN.MY_DOMAIN.com/',
  'htaccess.RewriteBase' => '/',
  'overwritehost' => 'MY_SUBDOMAIN.MY_DOMAIN.com',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'overwritecondaddr' => '^192.168.2.61$',
  'trusted_proxies' => 
  array (
    0 => '192.168.2.61',
    1 => '192.168.5.0/24',
    2 => '127.0.0.1',
    3 => '::1',
  ),
  'forwarded_for_headers' => 
  array (
    0 => 'HTTP_X_FORWARDED_FOR',
    1 => 'HTTP_X_FORWARDED',
  ),
  'maintenance' => false,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'theme' => '',
  'default_phone_region' => 'ES',
  'app_install_overwrite' => 
  array (
    0 => 'sharerenamer',
  ),
);

I have my Nextcloud behaind an Apache Proxy, located in 192.168.2.61

I hope you could find the issue. Take a closer look on special characters: / ^

joshtrichards commented 3 months ago

1.1.1.1 - - [31/Oct/2020:16:51:34 +0000] "POST /index.php/login HTTP/1.1" 303 6088 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/3.0.11"

I don't think this is a client issue. The redirect is coming from the Server.

Run curl -i https://xxx/ and confirm what the Location: header value is. If it has "/nextcloud" in it, then look at your server config.

castillo92 commented 3 months ago

1.1.1.1 - - [31/Oct/2020:16:51:34 +0000] "POST /index.php/login HTTP/1.1" 303 6088 "-" "Mozilla/5.0 (iOS) Nextcloud-iOS/3.0.11"

I don't think this is a client issue. The redirect is coming from the Server.

Run curl -i https://xxx/ and confirm what the Location: header value is. If it has "/nextcloud" in it, then look at your server config.

Passed 4 years since this issue was opened and 2 years since I put my config file and nobody comment with the same problem.

My opinion is to close this issue. It seems something misconfigured in proxy reverse or in nextcloud.config