sabre-io / dav

sabre/dav is a CalDAV, CardDAV and WebDAV framework for PHP
http://sabre.io
BSD 3-Clause "New" or "Revised" License
1.54k stars 348 forks source link

Localhost #1015

Open WouterGoossenss opened 7 years ago

WouterGoossenss commented 7 years ago

I'm trying to get a CardDAV server running for days now on my localhost. But when I try to connect from my Macbook or iPhone via accounts, nothing is happening? Is this supported in a localhost environment?

katie1348 commented 6 years ago

It is my experience that when connecting from the Contacts app in MacOS, you need to use the

principals/user

version of the URL, I too spent some time on this and my solution was to make sure that I was using the principals and not the direct version. I did not try this on a localhost, as my localhost server is a windows 10 box and nothing will work over the local network.

If using something like Thunderbird, it works with the full URL to the CardDav endpoint.

Gummibeer commented 6 years ago

I have a similar problem with WebDAV. I try to run the webdav server via the php built-in webserver on port 8000 and in the browser everything works. If I paste the url http://127.0.0.1:8000/webdav/ into my Mac Finder it tells me that there is a problem and I have to check my connection settings. What's wrong?

$directory = new \Sabre\DAV\FS\Directory(storage_path('webdav/storage'));
$server = new \Sabre\DAV\Server($directory);
$server->setBaseUri('/webdav');

$pdo = new PDO('sqlite:'.database_path('webdav.locks.sqlite'));
$lockBackend = new \Sabre\DAV\Locks\Backend\PDO($pdo);
$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
$server->addPlugin($lockPlugin);

$server->addPlugin(new \Sabre\DAV\Browser\Plugin());
$server->addPlugin(new \Sabre\DAV\Mount\Plugin());

$server->exec();
katie1348 commented 6 years ago

I have not tried the WebDAV portion of this, so I have no idea how to set this up correctly, but, I am guessing, you will need to add after the WebDAV part, the rest of the URL to get to the storage space, such as the user etc. As the URL you have shown, only takes you to the highest level in the system.

In the first instance, I would try typing in the complete URL all the way to a specific folder and see if that yields anything.

In my experience, the web site interface is more forgiving that the other routes in.