[Help] 415 Unsupported Media Type for contacts

I am working on getting Nextcloud to run in the Tomcat web server.
At the moment I am stuck on adding a new contact (the first entry, there are no contacts yet).

In the firefox console I see:

REPORT 
XHR 
https://192.168....:8443/nextcloud/remote.php/dav/addressbooks/users/admin/contacts/ [HTTP/1.1 415  1158ms]


Kopfzeilen

Antwortkopfzeilen

Cache-Control    private
Content-Language en
Content-Length   1098
Content-Type     text/html;charset=UTF-8
Date             Tue, 26 Sep 2017 10:37:36 GMT
Expires          Thu, 01 Jan 1970 01:00:00 CET

Anfragekopfzeilen

Accept          */*
Accept-Encoding gzip, deflate, br
Accept-Language de-DE,en-US;q=0.7,en;q=0.3
Authorization   Basic ...=
Connection      keep-alive
Content-Length  477
Content-Type    application/xml;charset=utf-8
Cookie          nc_sameSiteCookielax=true; nc_sameSiteCookiestrict=true; oc...=...; oc_sessionPassphrase=...
Depth           1
Host            192.168....:8443
User-Agent      Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
requesttoken    ...


POST

<card:addressbook-query xmlns:card="urn:ietf:params:xml:ns:carddav"\n                          xmlns:d="DAV:">\n    <d:prop>\n      <d:getetag />,<card:address-data />\n    </d:prop>\n    <!-- According to http://stackoverflow.com/questions/23742568/google-carddav-api-addressbook-multiget-returns-400-bad-request,\n         Google's CardDAV server requires a filter element. I don't think all addressbook-query calls need a filter in the spec though? -->\n  </card:addressbook-query>


Antwort

<!doctype html><html lang="en"><head><title>HTTP Status [415] – [Unsupported Media Type]</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status [415] – [Unsupported Media Type]</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Description</b> The origin server is refusing to service the request because the payload is in a format not supported by this method on the target resource.</p><hr class="line" /><h3>Apache Tomcat/9.0.0.M21</h3></body></html>


Cookies

nc_sameSiteCookielax    true
nc_sameSiteCookiestrict true
oc_sessionPassphrase    ...
oc...                   ...


Aufrufliste

send https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3641:7
	callee$2$0$ https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3156:22
	tryCatch https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:121:37
	invoke https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:294:22
	defineGeneratorMethod/Gp[method] https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:330:14
	onFulfilled https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3737:15
	co/< https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3726:5
	co https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3722:10
	send https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3134:15
	callee$0$0$ https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:1763:16
	tryCatch https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:121:37
	invoke https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:294:22
	defineGeneratorMethod/Gp[method] https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:330:14
	onFulfilled https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3737:15
	co/< https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3726:5
	co https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3722:10
	createPromise https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3702:12
	callee$0$0$ https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:1929:16
	tryCatch https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:121:37
	invoke https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:294:22
	defineGeneratorMethod/Gp[method] https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:330:14
	onFulfilled https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3737:15
	co/< https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3726:5
	co https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3722:10
	createPromise https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3702:12
	syncCollection https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:3438:12
	syncAddressBook https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:1832:10
	syncAddressBook https://192.168....:8443/nextcloud/apps/contacts/js/dav/dav.js:1540:14
	.sync https://192.168....:8443/nextcloud/apps/contacts/js/public/script.js:1513:11
	this.fillCache/loadPromise</< https://192.168....:8443/nextcloud/apps/contacts/js/public/script.js:1655:7
	this.fillCache/loadPromise< https://192.168....:8443/nextcloud/apps/contacts/js/public/script.js:1653:5

In nextcloud.log I see:

{"reqId":"...","level":4,"time":"2017-09-26T10:37:35+00:00","remoteAddr":"127.0.0.1","user":"admin","app":"webdav","method":"REPORT","url":"\/nextcloud\/remote.php\/dav\/addressbooks\/users\/admin\/contacts\/","message":"Exception: {\"Exception\":\"Sabre\\\\DAV\\\\Exception\\\\ReportNotSupported\",\"Message\":\"The addressbook-query report is not supported on this url with Depth: 0\",\"Code\":0,\"Trace\":\"#0 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/CardDAV\\\/Plugin.php(203): Sabre\\\\CardDAV\\\\Plugin->addressbookQueryReport(Object(Sabre\\\\CardDAV\\\\Xml\\\\Request\\\\AddressBookQueryReport))\\n#1 [internal function]: Sabre\\\\CardDAV\\\\Plugin->report('{urn:ietf:param...', Object(Sabre\\\\CardDAV\\\\Xml\\\\Request\\\\AddressBookQueryReport), 'addressbooks\\\/us...')\\n#2 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#3 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/CorePlugin.php(718): Sabre\\\\Event\\\\EventEmitter->emit('report', Array)\\n#4 [internal function]: Sabre\\\\DAV\\\\CorePlugin->httpReport(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#5 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/3rdparty\\\/sabre\\\/event\\\/lib\\\/EventEmitterTrait.php(105): call_user_func_array(Array, Array)\\n#6 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(479): Sabre\\\\Event\\\\EventEmitter->emit('method:REPORT', Array)\\n#7 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/DAV\\\/Server.php(254): Sabre\\\\DAV\\\\Server->invokeMethod(Object(Sabre\\\\HTTP\\\\Request), Object(Sabre\\\\HTTP\\\\Response))\\n#8 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/apps\\\/dav\\\/lib\\\/Server.php(253): Sabre\\\\DAV\\\\Server->exec()\\n#9 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/apps\\\/dav\\\/appinfo\\\/v2\\\/remote.php(33): OCA\\\\DAV\\\\Server->exec()\\n#10 \\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/remote.php(162): require_once('\\\/var\\\/www\\\/defaul...')\\n#11 {main}\",\"File\":\"\\\/var\\\/www\\\/default\\\/nextcloud##120002\\\/3rdparty\\\/sabre\\\/dav\\\/lib\\\/CardDAV\\\/Plugin.php\",\"Line\":439}","userAgent":"Mozilla\/5.0 (X11; Linux x86_64; rv:52.0) Gecko\/20100101 Firefox\/52.0","version":"12.0.2.0"}

I found what causes the problem: The β€œDepth” header was not forwarded to the PHP script.