Skip to content

OPTIONS Request Causes Connection Issues with Windows #1580

@RouatbiH

Description

@RouatbiH

When attempting to connect SabreDAV with a Windows, the server responds with a 401 Unauthorized status code for the OPTIONS request. This causes the Windows to abort the connection. Windows relies on the OPTIONS response to determine the available methods. Ideally, OPTIONS requests should not require authentication.
So I created a custom plugin to allow unauthenticated OPTIONS requests. The code is as follows:

<?php

namespace ProjectK\DAV\Auth\Plugin;

class Plugin extends \Sabre\DAV\Auth\Plugin
{
    public function initialize(\Sabre\DAV\Server $server)
    {
        $server->on('beforeMethod:*', function(\Sabre\HTTP\RequestInterface $request, \Sabre\HTTP\ResponseInterface $response) {
            if ($request->getMethod() !== 'OPTIONS')
            {
                $this->beforeMethod($request, $response);
            }
        }, 10);
    }
}

Is this behavior intentional, and if so, could you clarify the reasoning? If not, can this be considered a bug, and is there a plan to address it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions