kdav does not work with kweb



  • Hi,

    I have been trying to get kdav to work with kweb but it seems I am not understanding what the alias and folderish additions to caddy that you have created do.
    What I have in my extra.cfg is this, based on the help @longsleep provided to get the webapp to show up:

    alias /kdav/ /usr/share/webapps/kopano-kdav/
    fastcgi2 /kdav/ 127.0.0.1:9002 php {
      without /kdav/
      root /usr/share/webapps/kopano-kdav/
    }
    folderish /kdav
    

    Requests to https://<FQDN>/kdav/server.php however result in an XML error page like below:

    <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
    <script/>
    <s:sabredav-version>3.2.2</s:sabredav-version>
    <s:exception>Sabre\DAV\Exception\NotFound</s:exception>
    <s:message>File not found: server.php in 'root'</s:message>
    </d:error>
    

    Adding an index server.php entry to my extra.cfg takes me to the login and the overview for SabreDAV when browsing to https://<FQDN>/kdav/.

    Anything beyond the SabreDAV overview however does not work. Clicking on any of the collections for example results in an XML error page again and the below shows up in the kweb request log:

    192.168.0.1 - - [02/Apr/2019:03:25:10 +0200] "GET /kdav/principals/testu/ HTTP/2.0" 404 38 "https://<FQDN>/kdav/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36"
    

    I have found this example of how to make another DAV server (baikal) work with Caddy but that does not work because I can’t use another vhost / subdomain. I want to use the SSL certificate kweb obtains for my host via ACME. The solution relies on rewrites and redirects which do not work (?) when using your alias solution.

    I’d appreciate any assitance you can provide here. kdav itself works well when served with Apache on a different port.


  • Kopano

    @irreleph4nt have you changed the config.php to reflect that you are running in a subdirectory?



  • @fbartels
    In the scenario of using kdav with kweb, the DAV URI in config.php is set to /kdav/.
    When using kdav with Apache, as this does not require a subfolder, it’s set to /. The Apache config works completely without issue.

    When configured for kweb, I can get to the sabreDAV login and overview by adding the index server.php line to my kdav alias in kweb’s extra.cfg. Using anything beyond the overview, like accessing /server.php directly or consequently /server.php/calendars/<user>/Kalender fails with the errors shown and logged that I pasted above.



  • I have solved this; the current version of my extra.cfg and config.php can be found below. What helped me solve this was an issue on git for sabre.io/katana.

    One question that remains is this:
    How do I change my alias / folderish config so that kdav’s folder on the filesystem can be /usr/share/webapps/kopano-kdav/server.php but the service is accessible from https://<FQDN>/kdav/server.php instead? The way it is, my URL ends in kopano-kdav as well which does not look nice but at least it works.

    extra.cfg:

    alias /kopano-kdav/ /usr/share/webapps/kopano-kdav/
    fastcgi2 /kopano-kdav/ 127.0.0.1:9002 php {
    }
    folderish /kopano-kdav
    

    config.php

    // Location of the SabreDAV server.
    define('DAV_ROOT_URI', '/kopano-kdav/server.php');
    

Log in to reply