owncloud / android

:phone: The ownCloud Android App
GNU General Public License v2.0
3.81k stars 3.05k forks source link

[BUG] Unknown error while logging into OCIS #4206

Closed nordluf closed 10 months ago

nordluf commented 10 months ago

Actual behaviour

Login in the client is not working with the error "unknown error".

Expected behaviour

Login should work.

Steps to reproduce

  1. Setup OCIS on the subdomain without any additional folder in the path (like https://sub.domain.org/)
  2. Login using Google Play version of OwnCloud client
  3. See the issue.

Can this problem be reproduced with the official owncloud server? (url: https://demo.owncloud.org, user: test, password: test) Nope, it works

Environment data

Android version: 13 (TKQ1.221114.001)

Device model: Redmi Note 11 (2201117TY)

Stock or customized system: stock

ownCloud app version: 4.1.1 from Google Play

ownCloud server version: OCIS 4.0.2 from docker hub with such envs PROXY_TLS: "false" IDM_CREATE_DEMO_USERS: "false" OCIS_URL: https://sub.domain.org/ OCIS_INSECURE: "true"

The problem is, that after successful authentication client sends requests to //remote.php/dav/files/ or //ocs/v2.php/cloud/user. The duct tape fix I was able to implement is to add rewrite ^//(.*)$ /$1 last; in the Nginx config.

Logs

Web server error log

2023-10-31T13:32:11Z INF access-log bytes=8548 duration=5.09678 line=github.com/owncloud/ocis/v2/services/proxy/pkg/middleware/accesslog.go:31 method=PROPFIND path=//remote.php/dav/files/ proto=HTTP/1.1 remote-addr=... request-id=1bd12b2bfa15/Q0BuNFUaw2-000125 service=proxy status=200
2023-10-31T13:40:14Z INF access-log bytes=8548 duration=1.202519 line=github.com/owncloud/ocis/v2/services/proxy/pkg/middleware/accesslog.go:31 method=GET path=//ocs/v2.php/cloud/user proto=HTTP/1.1 remote-addr=... request-id=37343ec0-9e33-4629-88b2-8d7f2a1ddefd service=proxy status=200

ownCloud log (data/owncloud.log)

Method: PROPFIND URL: https://...//remote.php/dav/files/ Code: 200 Message: OK

at.bitfire.dav4jvm.exception.DavException: Expected 207 Multi-Status, got 200 OK
    at at.bitfire.dav4jvm.DavResource.assertMultiStatus(DavResource.kt:481)
    at at.bitfire.dav4jvm.DavResource.processMultiStatus(DavResource.kt:510)
    at at.bitfire.dav4jvm.DavOCResource.propfind(DavOCResource.kt:326)

Create RemoteOperationResult from exception.
 Message: DavException: Expected 207 Multi-Status, got 200 OK
 Stacktrace: at.bitfire.dav4jvm.exception.DavException: Expected 207 Multi-Status, got 200 OK
    at at.bitfire.dav4jvm.DavResource.assertMultiStatus(DavResource.kt:481)
    at at.bitfire.dav4jvm.DavResource.processMultiStatus(DavResource.kt:510)
    at at.bitfire.dav4jvm.DavOCResource.propfind(DavOCResource.kt:326)
    at com.owncloud.android.lib.common.http.methods.webdav.PropfindMethod.onDavExecute(PropfindMethod.kt:52)
Ke1i commented 10 months ago

I'm running the latest oCIS server (binary build ver. 4.0.2 on baremetal together with Caddy as my reverse proxy) and I'm not experiencing any errors with the Android client I'm using (latest git release as of posting) I've been running it like so with prior oCIS server releases and I've never experienced the error you're describing above. Nginx could be the culprit. If you can, try something else like Traefik to rule this out.

jesmrec commented 10 months ago

That problem happens in the dav library, in the propfind call, so, it something regarding request/response content. As @Ke1i states, please review your middleware setup because is directly related. you can check to connect directly client to server and compare logs/requests with and without middleware.

nordluf commented 10 months ago

The problem was, that OCIS_URL contained the trailing slash at the end, that's why some URLs returned by the system were malformed. The desktop client worked fine, though. Nevertheless, I'm sure that this bug has to be reported to ocis itself.