Can't sync with Radicale : "HTTP error : 302 Moved Temporarily"



  • Hi,

    I get this error : "HTTP error : 302 Moved Temporarily" when I try to add a new davdroid account in order to sync with my Radicale server.

    For the server url field I tried :
    domain/sync/username/
    domain/sync/
    domain/sync/username/Test.vcf/
    but I always get the same error.

    Radicale is installed as an app in a YunoHost server.
    Android version : 4.4.2

    Radicale sync is working fine with other carddav or caldav clients.

    Thanks !


  • developer

    I have DAVdroid running with Radicale. Your server sends a redirection somewhere, please try to find out where/why the server sends a redirection yourself and/or provide logs. Server logs would also be helpful.



  • Thanks for your answer.
    I figured there was a redirection somewhere but couldn't understand where and why... When I use wget on this url : "https://mydomain.org/sync/username/" I don't see any redirection.

    Here are my logcat logs when I try to add a davdroid account with the following url (I've replaced my domain and username with fake ones) :
    https://mydomain.org/sync/username/

    I/davdroid.QueryServerDialogFragment( 4171): onCreateLoader
    D/davdroid.SNISocketFactory( 4171): Setting SNI hostname
    I/davdroid.SNISocketFactory( 4171): Established TLSv1 connection with mydomain.org using TLS_RSA_WITH_AES_128_CBC_SHA
    D/davdroid.WebDavResource( 4171): Received HTTP/1.1 200 OK
    D/davdroid.HttpPropfind( 4171): Prepared PROPFIND request: <propfind xmlns="DAV:">
    D/davdroid.HttpPropfind( 4171):    <prop>
    D/davdroid.HttpPropfind( 4171):       <current-user-principal/>
    D/davdroid.HttpPropfind( 4171):    </prop>
    D/davdroid.HttpPropfind( 4171): </propfind>
    D/davdroid.WebDavResource( 4171): Received HTTP/1.1 207 Unknown
    D/davdroid.WebDavResource( 4171): Processing multi-status element: https://mydomain.org/sync/username/
    D/davdroid.WebDavResource( 4171): <?xml version="1.0"?>
    D/davdroid.WebDavResource( 4171): <multistatus xmlns="DAV:">
    D/davdroid.WebDavResource( 4171):   <response>
    D/davdroid.WebDavResource( 4171):     <href>/sync/username/</href>
    D/davdroid.WebDavResource( 4171):     <propstat>
    D/davdroid.WebDavResource( 4171):       <prop>
    D/davdroid.WebDavResource( 4171):         <current-user-principal>
    D/davdroid.WebDavResource( 4171):           <href>/username/</href>
    D/davdroid.WebDavResource( 4171):         </current-user-principal>
    D/davdroid.WebDavResource( 4171):       </prop>
    D/davdroid.WebDavResource( 4171):       <status>HTTP/1.1 200 OK</status>
    D/davdroid.WebDavResource( 4171):     </propstat>
    D/davdroid.WebDavResource( 4171):   </response>
    D/davdroid.WebDavResource( 4171): </multistatus>
    I/davdroid.ServerInfoLoader( 4171): Found principal path: /username/
    D/davdroid.HttpPropfind( 4171): Prepared PROPFIND request: <propfind xmlns="DAV:">
    D/davdroid.HttpPropfind( 4171):    <prop>
    D/davdroid.HttpPropfind( 4171):       <CD:addressbook-home-set xmlns:CD="urn:ietf:params:xml:ns:carddav"/>
    D/davdroid.HttpPropfind( 4171):       <C:calendar-home-set xmlns:C="urn:ietf:params:xml:ns:caldav"/>
    D/davdroid.HttpPropfind( 4171):    </prop>
    D/davdroid.HttpPropfind( 4171): </propfind>
    D/davdroid.WebDavResource( 4171): Received HTTP/1.1 302 Moved Temporarily
    

    And here are the nginx logs

    xx.xx.xx.xx - - [22/Jan/2014:02:06:23 +0100] "OPTIONS /sync/username/ HTTP/1.1" 200 5 "-" "DAVdroid/0.5.6-alpha"
    xx.xx.xx.xx - - [22/Jan/2014:02:06:23 +0100] "PROPFIND /sync/username/ HTTP/1.1" 401 5 "-" "DAVdroid/0.5.6-alpha"
    xx.xx.xx.xx - username [22/Jan/2014:02:06:23 +0100] "PROPFIND /sync/username/ HTTP/1.1" 207 312 "-" "DAVdroid/0.5.6-alpha"
    xx.xx.xx.xx - - [22/Jan/2014:02:06:23 +0100] "PROPFIND /username/ HTTP/1.1" 302 160 "-" "DAVdroid/0.5.6-alpha"
    
    

    And finally, I don't know if it's necessary but here are the radicale logs from the server :

    2014-01-22 01:49:14,419 - INFO: OPTIONS request at /sync/username/ received
    2014-01-22 01:49:14,420 - DEBUG: Request headers:
    {'CONTENT_LENGTH': '',
     'CONTENT_TYPE': '',
     'DOCUMENT_ROOT': '/usr/share/nginx/html',
     'HTTPS': 'on',
     'HTTP_ACCEPT_ENCODING': 'gzip',
     'HTTP_CONNECTION': 'Keep-Alive',
     'HTTP_HOST': 'mydomain.org',
     'HTTP_SET_COOKIE': 'SSOwAuthRedirect=;; Path=/ynhsso/; Max-Age=Thu, Jan 01 1970 00:00:00 UTC;',
     'HTTP_USER_AGENT': 'DAVdroid/0.5.6-alpha',
     'PATH_INFO': '/sync/username/',
     'QUERY_STRING': '',
     'REMOTE_ADDR': 'xx.xx.xx.xx',
     'REMOTE_PORT': '33971',
     'REQUEST_METHOD': 'OPTIONS',
     'REQUEST_URI': '/sync/username/',
     'SERVER_NAME': 'mydomain.org',
     'SERVER_PORT': '443',
     'SERVER_PROTOCOL': 'HTTP/1.1',
     'UWSGI_SCHEME': 'https',
     'uwsgi.node': 'mydomain',
     'uwsgi.version': '1.2.3-debian',
     'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x7f921e0c6c90>,
     'wsgi.file_wrapper': <built-in function uwsgi_sendfile>,
     'wsgi.input': <uwsgi._Input object at 0xc2a380>,
     'wsgi.multiprocess': True,
     'wsgi.multithread': False,
     'wsgi.run_once': False,
     'wsgi.url_scheme': 'https',
     'wsgi.version': (1, 0)}
    2014-01-22 01:49:14,420 - DEBUG: Sanitized path: /sync/username/
    2014-01-22 01:49:14,420 - DEBUG: Anonymous has read access to collection sync/username/
    2014-01-22 01:49:14,420 - DEBUG: Anonymous has write access to collection sync/username/
    2014-01-22 01:49:14,420 - DEBUG: Answer status: 200 OK
    2014-01-22 01:49:14,498 - INFO: PROPFIND request at /sync/username/ received
    2014-01-22 01:49:14,499 - DEBUG: Request headers:
    {'CONTENT_LENGTH': '88',
     'CONTENT_TYPE': 'text/xml; charset="utf-8"',
     'DOCUMENT_ROOT': '/usr/share/nginx/html',
     'HTTPS': 'on',
     'HTTP_ACCEPT_ENCODING': 'gzip',
     'HTTP_CONNECTION': 'Keep-Alive',
     'HTTP_CONTENT_LENGTH': '88',
     'HTTP_CONTENT_TYPE': 'text/xml; charset="utf-8"',
     'HTTP_DEPTH': '0',
     'HTTP_HOST': 'mydomain.org',
     'HTTP_SET_COOKIE': 'SSOwAuthRedirect=;; Path=/ynhsso/; Max-Age=Thu, Jan 01 1970 00:00:00 UTC;',
     'HTTP_USER_AGENT': 'DAVdroid/0.5.6-alpha',
     'PATH_INFO': '/sync/username/',
     'QUERY_STRING': '',
     'REMOTE_ADDR': 'xx.xx.xx.xx',
     'REMOTE_PORT': '33971',
     'REQUEST_METHOD': 'PROPFIND',
     'REQUEST_URI': '/sync/username/',
     'SERVER_NAME': 'mydomain.org',
     'SERVER_PORT': '443',
     'SERVER_PROTOCOL': 'HTTP/1.1',
     'UWSGI_SCHEME': 'https',
     'uwsgi.node': 'mydomain',
     'uwsgi.version': '1.2.3-debian',
     'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x7f921e0c6c90>,
     'wsgi.file_wrapper': <built-in function uwsgi_sendfile>,
     'wsgi.input': <uwsgi._Input object at 0xc2a380>,
     'wsgi.multiprocess': True,
     'wsgi.multithread': False,
     'wsgi.run_once': False,
     'wsgi.url_scheme': 'https',
     'wsgi.version': (1, 0)}
    2014-01-22 01:49:14,499 - DEBUG: Sanitized path: /sync/username/
    2014-01-22 01:49:14,499 - DEBUG: Request content:
    <propfind xmlns="DAV:">
       <prop>
          <current-user-principal/>
       </prop>
    </propfind>
    2014-01-22 01:49:14,499 - DEBUG: LDAP bind for uid=None in base ou=users,dc=yunohost,dc=org
    2014-01-22 01:49:14,500 - DEBUG: Used LDAP filter: uid=None
    2014-01-22 01:49:14,500 - DEBUG: User None not found
    2014-01-22 01:49:14,500 - DEBUG: LDAP bind failed
    2014-01-22 01:49:14,500 - INFO: Anonymous user refused
    2014-01-22 01:49:14,500 - DEBUG: Answer status: 401 Unauthorized
    2014-01-22 01:49:14,509 - INFO: PROPFIND request at /sync/username/ received
    2014-01-22 01:49:14,510 - DEBUG: Request headers:
    {'CONTENT_LENGTH': '88',
     'CONTENT_TYPE': 'text/xml; charset="utf-8"',
     'DOCUMENT_ROOT': '/usr/share/nginx/html',
     'HTTPS': 'on',
     'HTTP_ACCEPT_ENCODING': 'gzip',
     'HTTP_AUTHORIZATION': 'Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==',
     'HTTP_CONNECTION': 'Keep-Alive',
     'HTTP_CONTENT_LENGTH': '88',
     'HTTP_CONTENT_TYPE': 'text/xml; charset="utf-8"',
     'HTTP_DEPTH': '0',
     'HTTP_HOST': 'mydomain.org',
     'HTTP_SET_COOKIE': 'SSOwAuthRedirect=;; Path=/ynhsso/; Max-Age=Thu, Jan 01 1970 00:00:00 UTC;',
     'HTTP_USER_AGENT': 'DAVdroid/0.5.6-alpha',
     'PATH_INFO': '/sync/username/',
     'QUERY_STRING': '',
     'REMOTE_ADDR': 'xx.xx.xx.xx',
     'REMOTE_PORT': '33971',
     'REQUEST_METHOD': 'PROPFIND',
     'REQUEST_URI': '/sync/username/',
     'SERVER_NAME': 'mydomain.org',
     'SERVER_PORT': '443',
     'SERVER_PROTOCOL': 'HTTP/1.1',
     'UWSGI_SCHEME': 'https',
     'uwsgi.node': 'mydomain',
     'uwsgi.version': '1.2.3-debian',
     'wsgi.errors': <open file 'wsgi_errors', mode 'w' at 0x7f921e0c6c90>,
     'wsgi.file_wrapper': <built-in function uwsgi_sendfile>,
     'wsgi.input': <uwsgi._Input object at 0xc2a380>,
     'wsgi.multiprocess': True,
     'wsgi.multithread': False,
     'wsgi.run_once': False,
     'wsgi.url_scheme': 'https',
     'wsgi.version': (1, 0)}
    2014-01-22 01:49:14,510 - DEBUG: Sanitized path: /sync/username/
    2014-01-22 01:49:14,510 - DEBUG: Request content:
    <propfind xmlns="DAV:">
       <prop>
          <current-user-principal/>
       </prop>
    </propfind>
    2014-01-22 01:49:14,510 - DEBUG: LDAP bind for uid=username in base ou=users,dc=yunohost,dc=org
    2014-01-22 01:49:14,510 - DEBUG: Used LDAP filter: uid=username
    2014-01-22 01:49:14,511 - DEBUG: User username found
    2014-01-22 01:49:14,511 - DEBUG: LDAP bind OK
    2014-01-22 01:49:14,511 - DEBUG: username has read access to collection sync/username/
    2014-01-22 01:49:14,511 - DEBUG: username has write access to collection sync/username/
    2014-01-22 01:49:14,512 - DEBUG: Response content:
    <?xml version="1.0"?>
    <multistatus xmlns="DAV:">
      <response>
        <href>/sync/username/</href>
        <propstat>
          <prop>
            <current-user-principal>
              <href>/username/</href>
            </current-user-principal>
          </prop>
          <status>HTTP/1.1 200 OK</status>
        </propstat>
      </response>
    </multistatus>
    
    2014-01-22 01:49:14,512 - DEBUG: Answer status: 207 Unknown
    
    

    thanks


  • developer

    D/davdroid.WebDavResource( 4171):         <current-user-principal>
    D/davdroid.WebDavResource( 4171):           <href>/username/</href>
    D/davdroid.WebDavResource( 4171):         </current-user-principal>
    

    While you say /sync/username/ is your Radicale principal directory, Radicale says it's /username/ (causing DAVdroid to look into /username, causing the Web server to send a redirection). Please set the correct base_prefix in your Radicale configuration.

    See #41 and #107.

    Radicale sync is working fine with other carddav or caldav clients.

    Seems quite strange because the server seems to be misconfigured. If the problem is really fixed by setting base_path, you may contact the other clients' manufacturers.



  • Thanks ! Changing the base_prefix fixed the problem. I had to set it to "/sync/" instead of "/".

    I think I will inform YunoHost developers about this issue since Radicale is installed as a YunoHost app, I suppose it could be configured automatically during the installation of the app.

    Thanks again !


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.