Skip to content

Backing up using webDAV from DAVx⁵ to nginx fails with HTTP 409, HTTP 405 #500

@aqweoijn

Description

@aqweoijn

Using DAVx⁵ initially from f-droid version 4.2.6-ose - then changed to a locally compiled debug version off commit bee7cf20, with seedvault in LineageOS 19-20221220-microG-mata, when I chose DAVx⁵ as the backup location to setup a webDAV mount, I get DAVx⁵ logs:

01-10 17:02:33.284 V/davx5   ( 8315): [HttpClient] --> MKCOL https://<domain>/.SeedVaultAndroidBackup http/1.1                                                                                                                    
01-10 17:02:33.284 V/davx5   ( 8315): [HttpClient] User-Agent: DAVx5/4.3-alpha.1-ose (2023/01/10; dav4jvm; okhttp/4.10.0) Android/12                                                                                                          
01-10 17:02:33.285 V/davx5   ( 8315): [HttpClient] Accept-Language: en-CA, en;q=0.7, *;q=0.5                                                                                                                                                  01-10 17:02:33.286 V/davx5   ( 8315): [HttpClient] Host: <domain>                                                                                                                                                                 
01-10 17:02:33.286 V/davx5   ( 8315): [HttpClient] Connection: Keep-Alive                                                                                                                                                                     
01-10 17:02:33.286 V/davx5   ( 8315): [HttpClient] Accept-Encoding: gzip                                                                                                                                                                      
01-10 17:02:33.287 V/davx5   ( 8315): [HttpClient] --> END MKCOL                                                                                                                                                                              
01-10 17:02:33.287 D/dav4jvm ( 8315): [at.bitfire.dav4jvm.BasicDigestAuthHandler] Trying Basic auth preemptively
01-10 17:02:33.288 D/dav4jvm ( 8315): [at.bitfire.dav4jvm.BasicDigestAuthHandler] Adding Basic authorization header for https://<domain>/.SeedVaultAndroidBackup
01-10 17:02:33.295 V/davx5   ( 8315): [HttpClient] <-- 409 Conflict https://<domain>/.SeedVaultAndroidBackup (7ms)
01-10 17:02:33.295 V/davx5   ( 8315): [HttpClient] Server: nginx/1.23.3
01-10 17:02:33.296 V/davx5   ( 8315): [HttpClient] Date: Wed, 11 Jan 2023 01:02:33 GMT
01-10 17:02:33.296 V/davx5   ( 8315): [HttpClient] Content-Type: text/html
01-10 17:02:33.297 V/davx5   ( 8315): [HttpClient] Content-Length: 151
01-10 17:02:33.297 V/davx5   ( 8315): [HttpClient] Connection: keep-alive
01-10 17:02:33.297 V/davx5   ( 8315): [HttpClient] <-- END HTTP

and nginx logs:

Jan 10 17:02:33 web nginx[11506]: 2023/01/10 17:02:33 [error] 11506#11506: *3304 MKCOL can create a collection only, client: 192.168.1.1, server: <domain>, request: "MKCOL /.SeedVaultAndroidBackup HTTP/1.1", host: "<domain>"

and no files are created on the server.

If I hack a trailing slash onto the MKCOL in DAVx⁵, then I can add the backup location without error, but when I try to start a backup I get the logs:

01-10 17:11:02.248 V/davx5   ( 9605): [HttpClient] --> PROPFIND https://<domain>/ http/1.1
01-10 17:11:02.249 V/davx5   ( 9605): [HttpClient] Depth: 1 
01-10 17:11:02.249 V/davx5   ( 9605): [HttpClient] User-Agent: DAVx5/4.3-alpha.1-ose (2023/01/10; dav4jvm; okhttp/4.10.0) Android/12
01-10 17:11:02.250 V/davx5   ( 9605): [HttpClient] Accept-Language: en-CA, en;q=0.7, *;q=0.5
01-10 17:11:02.250 V/davx5   ( 9605): [HttpClient] Content-Type: application/xml; charset=utf-8
01-10 17:11:02.250 V/davx5   ( 9605): [HttpClient] Content-Length: 346
01-10 17:11:02.251 V/davx5   ( 9605): [HttpClient] Host: <domain>
01-10 17:11:02.251 V/davx5   ( 9605): [HttpClient] Connection: Keep-Alive
01-10 17:11:02.251 V/davx5   ( 9605): [HttpClient] Accept-Encoding: gzip
01-10 17:11:02.252 V/davx5   ( 9605): [HttpClient] --> END PROPFIND
01-10 17:11:02.252 D/dav4jvm ( 9605): [at.bitfire.dav4jvm.BasicDigestAuthHandler] Trying Basic auth preemptively
01-10 17:11:02.252 D/dav4jvm ( 9605): [at.bitfire.dav4jvm.BasicDigestAuthHandler] Adding Basic authorization header for https://<domain>/
01-10 17:11:02.256 V/davx5   ( 9605): [HttpClient] <-- 207 Multi-Status https://<domain>/ (3ms)
01-10 17:11:02.257 V/davx5   ( 9605): [HttpClient] Server: nginx/1.23.3
01-10 17:11:02.257 V/davx5   ( 9605): [HttpClient] Date: Wed, 11 Jan 2023 01:11:02 GMT
01-10 17:11:02.258 V/davx5   ( 9605): [HttpClient] Content-Type: text/xml; charset=utf-8
01-10 17:11:02.258 V/davx5   ( 9605): [HttpClient] Content-Length: 368
01-10 17:11:02.259 V/davx5   ( 9605): [HttpClient] Connection: keep-alive
01-10 17:11:02.259 V/davx5   ( 9605): [HttpClient] <-- END HTTP
01-10 17:11:02.263 D/davx5   ( 9605): [webdav.DavDocumentsProvider] SELF Response(requestedUrl=https://<domain>/, href=https://<domain>/, status=null, propstat=[PropStat(properties=[DisplayName(displayName=/), GetL
astModified(lastModified=1673428253000), [DAV::collection]], status=HTTP/1.1 200 OK, error=null)], error=null, newLocation=null)
...
01-10 17:11:02.349 V/davx5   ( 9605): [HttpClient] --> MKCOL https://<domain>/.SeedVaultAndroidBackup%2F http/1.1
01-10 17:11:02.349 V/davx5   ( 9605): [HttpClient] User-Agent: DAVx5/4.3-alpha.1-ose (2023/01/10; dav4jvm; okhttp/4.10.0) Android/12
01-10 17:11:02.349 V/davx5   ( 9605): [HttpClient] Accept-Language: en-CA, en;q=0.7, *;q=0.5
01-10 17:11:02.350 V/davx5   ( 9605): [HttpClient] Host: <domain>
01-10 17:11:02.350 V/davx5   ( 9605): [HttpClient] Connection: Keep-Alive
01-10 17:11:02.350 V/davx5   ( 9605): [HttpClient] Accept-Encoding: gzip
01-10 17:11:02.351 V/davx5   ( 9605): [HttpClient] --> END MKCOL
01-10 17:11:02.351 D/dav4jvm ( 9605): [at.bitfire.dav4jvm.BasicDigestAuthHandler] Trying Basic auth preemptively
01-10 17:11:02.352 D/dav4jvm ( 9605): [at.bitfire.dav4jvm.BasicDigestAuthHandler] Adding Basic authorization header for https://<domain>/.SeedVaultAndroidBackup%2F
01-10 17:11:02.357 V/davx5   ( 9605): [HttpClient] <-- 405 Not Allowed https://<domain>/.SeedVaultAndroidBackup%2F (4ms)
01-10 17:11:02.357 V/davx5   ( 9605): [HttpClient] Server: nginx/1.23.3
01-10 17:11:02.358 V/davx5   ( 9605): [HttpClient] Date: Wed, 11 Jan 2023 01:11:02 GMT
01-10 17:11:02.359 V/davx5   ( 9605): [HttpClient] Content-Type: text/html
01-10 17:11:02.359 V/davx5   ( 9605): [HttpClient] Content-Length: 157
01-10 17:11:02.359 V/davx5   ( 9605): [HttpClient] Connection: keep-alive
01-10 17:11:02.360 V/davx5   ( 9605): [HttpClient] <-- END HTTP
01-10 17:11:02.363 E/JavaBinder( 9605): *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
01-10 17:11:02.363 E/JavaBinder( 9605): java.lang.RuntimeException: at.bitfire.dav4jvm.exception.HttpException: HTTP 405 Not Allowed
01-10 17:11:02.363 E/JavaBinder( 9605):         at android.os.Parcel.writeException(Parcel.java:2211)
01-10 17:11:02.363 E/JavaBinder( 9605):         at android.database.DatabaseUtils.writeExceptionToParcel(DatabaseUtils.java:117)

and nginx logs:

Jan 10 17:11:01 web nginx[11506]: 2023/01/10 17:11:01 [error] 11506#11506: *3729 mkdir() "/webdav/data/.SeedVaultAndroidBackup" failed (17: File exists), client: 192.168.1.1, server: <domain>, request: "MKCOL /.SeedVaultAndroidBackup%2F HTTP/1.1", host: "<domain>"
Jan 10 17:11:02 web nginx[11506]: 2023/01/10 17:11:02 [error] 11506#11506: *3731 mkdir() "/webdav/data/.SeedVaultAndroidBackup" failed (17: File exists), client: 192.168.1.1, server: <domain>, request: "MKCOL /.SeedVaultAndroidBackup%2F HTTP/1.1", host: "<domain>"

which results in just an empty .SeedVaultAndroidBackup/ created on the server.

I think nginx might be being more strict about webDAV than some other servers. I'm not sure if the responsibility lies with seedvault to i.e. MKCOL with a trailing slash, or if that's DAVx⁵'s responsibility to translate a generic "mkdir" into the appropriate webDAV MKCOL with a trailing slash - if it's the latter I'd be happy to move this issue to them.

I realize none of this clearly points to seedvault, seedvault is just erroring once DAVx⁵ throws an exception.

Have you seen anything like this, or do know what could be causing it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions