Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPTIONS Request Causes Connection Issues with Windows #1580

Open
RouatbiH opened this issue Jan 4, 2025 · 0 comments
Open

OPTIONS Request Causes Connection Issues with Windows #1580

RouatbiH opened this issue Jan 4, 2025 · 0 comments

Comments

@RouatbiH
Copy link

RouatbiH commented Jan 4, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant