cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Community 6.2 WebDAV PROPFIND returns 302 Found instead of 404 Not found

BzF
Champ in-the-making
Champ in-the-making

Hi,
we have problem with WebDAV in Alfresco Community 6.2.
Installation is in Docker on Windows Server 2019 (from https://github.com/Alfresco/alfresco-docker-installer with nginx as reverse proxy).

Access from OS to WebDAV works fine, but there is a problem with scanning to WebDAV folder from Multifunctional Office Printer (Konica Minolta Bizhub).
The machine sends request PROPFIND for file which does not exist.
Response should be 404 (Not found) but instead Alfresco sends 302 with Location: http://192.168.xxx.yyy:443/alfresco/webdav/. Without 404 for file which does not exist the scanner does not save new scan (PUT request).

Test with curl and PROPFIND request:

$ curl --insecure --anyauth --user 'xxx:yyy' --include --request PROPFIND 'https://192.168.xxx.yyy/alfresco/webdav/Scanner/does_not_exist.txt'
HTTP/1.1 401
Server: nginx/1.18.0
Date: Mon, 28 Dec 2020 12:28:42 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: JSESSIONID=481FD60C93D2DF7A5EFC167E04A29757; Path=/alfresco; HttpOnly
WWW-Authenticate: BASIC realm="Alfresco DAV Server"

HTTP/1.1 302
Server: nginx/1.18.0
Date: Mon, 28 Dec 2020 12:28:42 GMT
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 0
Connection: keep-alive
Set-Cookie: JSESSIONID=19B368ED5641CC0963E45D123D4C2DE5; Path=/alfresco; HttpOnly
Location: http://192.168.xxx.yyy:443/alfresco/webdav/

For GET request on same not existing file it properly returns 404:

$ curl --insecure --anyauth --user 'xxx:yyy' --include --request GET 'https://192.168.xxx.yyy/alfresco/webdav/Scanner/does_not_exist.txt'
HTTP/1.1 401
Server: nginx/1.18.0
Date: Mon, 28 Dec 2020 12:27:34 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: JSESSIONID=2BE6DCBF4175C1DAE48A4AC89E7B4190; Path=/alfresco; HttpOnly
WWW-Authenticate: BASIC realm="Alfresco DAV Server"

HTTP/1.1 404
Server: nginx/1.18.0
Date: Mon, 28 Dec 2020 12:27:34 GMT
Content-Type: text/html;charset=ISO-8859-1
Content-Length: 1173
Connection: keep-alive
Set-Cookie: JSESSIONID=117D3FA900D46F5E93DA17EC8CEAEC78; Path=/alfresco; HttpOnly

<!-- Enterprise index-jsp placeholder -->
...

Is there a way how to return 404 response for PROPFIND requests on not existing files?

2 REPLIES 2

afaust
Legendary Innovator
Legendary Innovator

So the PROPFIND implementation never issues a 302 Found response. I actually could not find any 302 response being issued anywhere in Alfresco's WebDAV code. Whatever is causing this redirect, it must be before the actual WebDAV endpoint is actually being involved.

What is you authentication setup in Alfresco? It looks to me like you may have single sign-on enabled in a subsystem, otherwise there should normally not be session cookies being set. The fact that the 302 response also sends with it a text/html response tells me that SSO enabled subsystem is issueing the redirect to a base path, which - in older Alfresco versions - used to point instead to the Alfresco Explorer UI, but since ACS no longer has that UI, now just uses the servlet root.
Why is there a 401 response in your trace even though you pro-actively specify the user and password with cURL, which should skip that phase completely?

jlesage
Confirmed Champ
Confirmed Champ

There is a redirection in `error.jsp` in the alfresco.war, that catch error 404 only for PROPFIND and OPTIONS requests. Remove this lines will solve the problem.

https://github.com/Alfresco/alfresco-community-repo/blob/master/packaging/war/src/main/webapp/error....

<%
// route WebDAV requests
if (request.getMethod().equalsIgnoreCase("PROPFIND") || request.getMethod().equalsIgnoreCase("OPTIONS"))
{
   response.sendRedirect(request.getContextPath() + "/webdav/");
}
%>
Jérémie Lesage
https://jeci.fr