MailSuite Pro documentation

Configuring DAV server

Introduction

MailSuite Pro uses CalDAV server to store and process calendar entries, and CardDAV server is used for storing contacts and groups. Eventually, it's the same DAV server used, and it's a solid part of MailSuite Pro. In most cases, it will work out of the box, but you might need to perform additional reconfiguration, particularly if you plan to use mobile sync feature.

URL rewriting

When you set up the product using built-in installation wizard, it will automatically detect URL used for CalDAV sync. Default value is http://yourhost.com/dav/server.php/ (note that trailing slash is mandatory).

It is strongly advised to configure your web server so that URLs are rewritten and easier to enter from, say, mobile device.

Configuring web server

For nginx webserver, add the following rule to your current location:

root webmail/dav;
index server.php;

if ( !-d $request_filename) {
    rewrite ^(.*) /server.php last;
}

In the above configuration sample, webmail stands for MailSuite Pro installation location which is subdirectory of web server document root.

To make sure all the http methods required by DAV server are allowed, the following configuration is performed:

if ($request_method ~ ^(OPTIONS|GET|HEAD|DELETE|PROPFIND|PUT|PROPPATCH|COPY|MOVE|MKCOL|REPORT)$) {
    fastcgi_pass 127.0.0.1:1028;
}

It should point to existing PHP backend or another web server where PHP backend runs.

Typical host configuration would look like:

location /dav.php {
    include fastcgi_params;

    fastcgi_read_timeout 180s;
    fastcgi_pass  unix:/opt/afterlogic/tmp/php5-fpm.sock;
    fastcgi_param  SCRIPT_FILENAME  $document_root/dav.php;

    fastcgi_split_path_info ^(.+\.php)(/[^?]*).*$;

    fastcgi_param  SCRIPT_NAME      $fastcgi_script_name;
    fastcgi_param  PATH_INFO        $fastcgi_path_info;
}

However, if you choose to use a separate domain or subdomain for DAV access, configuration will be different:

location = / {
    try_files @dav @dav;
}

location / {
    try_files $uri $uri/ @dav;
}

location ~* \.php$ {
    return 404;
}

location @dav {
    include fastcgi_params;
    fastcgi_read_timeout   180s;
    fastcgi_pass    unix:/opt/afterlogic/tmp/php5-fpm.sock;
    fastcgi_index   server.php;
    fastcgi_param   SCRIPT_FILENAME $document_root/server.php;
}

Configuring .well-known access

Another good way of ensuring proper mobile sync setup is to use .well-known access. Various clients, including the one used in iOS, attempt to determine correct DAV URL by sending request to a special subdirectory name, and we can handle those requests to redirect to DAV server.

For nginx webserver, the following configuration should help:

location / {
   rewrite ^/.well-known/carddav /dav/server.php/ redirect;
   rewrite ^/.well-known/caldav /dav/server.php/ redirect;
}

NB: With configuration settings supplied that way, you'll need to use your MailSuite Pro installation URL as DAV URL, without any suffixes etc.

Setting base product URL

As of version 9.7.1, DAV server sends out invites out when event is added or edited via DAV client. To ensure the invite links in email messages are correct, you need to set "ProductUrlForExternalClients" value in data/settings/modules/Dav.config.json configuration file to base URL of MailSuite Pro installation.

Conclusion

Once the product is installed and webserver is fully configured for DAV support, you should be able to sync your mobile device with your MailSuite Pro account. Sync URL is found in the account settings. Entering just the URL would be fine, but if port 8008 is used, the http:// part should be omitted.