WebDAV

On this page 7

WebDAV (Web Distributed Authoring and Versioning) is an extension of HTTP that turns a web server into a remote file store, letting clients create, read, modify, copy, move and lock resources and organize them in collections, the equivalent of folders. Among Internet protocols, it stands out because it adds collaborative authoring to the same transport that already serves web pages, so it works through ordinary web ports, proxies and TLS.

The core specification is RFC 4918, which replaced the original RFC 2518. Related standards build on it, most notably CalDAV for calendars and CardDAV for contacts, which explains why the protocol is still widely deployed even where users never see the name.

How WebDAV extends HTTP

WebDAV keeps the HTTP request and response model and adds new methods, headers and XML bodies. Standard methods such as GET, PUT and DELETE still download, upload and remove files, while the extension methods handle properties, collections, namespace operations and locks. Responses that cover several resources use the 207 Multi-Status code with an XML body listing a separate status for each one.

The table below lists the methods that WebDAV adds and what each one does.

MethodPurposeTypical response
PROPFINDRead properties and list collection members207 Multi-Status
PROPPATCHSet or remove properties207 Multi-Status
MKCOLCreate a collection201 Created
COPYDuplicate a resource or collection201 Created or 204 No Content
MOVERename or relocate a resource201 Created or 204 No Content
LOCKTake or refresh a write lock200 OK with lock token
UNLOCKRelease a lock204 No Content
Methods defined by WebDAV

Clients control the scope of PROPFIND with the Depth header, using 0 for the resource itself, 1 for its direct children and infinity for an entire tree. Many servers refuse Depth: infinity because a single request could otherwise force the server to walk millions of files.

Properties, collections and locking

Every WebDAV resource carries properties, which are named metadata values expressed in XML. Live properties are maintained by the server, such as size, content type and last modification time; dead properties are arbitrary values stored on behalf of clients, for example an author or a review status.

Locking prevents the lost update problem, in which two editors overwrite each other’s changes. A client issues LOCK, receives a lock token, and must present that token in the If header on later writes. Locks have a timeout and must be refreshed, so a crashed client does not block a document forever.

Lock propertyValueEffect
Exclusive write locklockscope exclusiveOnly the lock holder may modify
Shared write locklockscope sharedSeveral holders cooperate on changes
Depth 0Single resourceLocks one file only
Depth infinityCollection and membersLocks a whole folder tree
TimeoutSeconds or InfiniteLock expires unless refreshed
Lock types and scopes in WebDAV

WebDAV locks are enforced only for WebDAV requests, so they protect writes that pass through the WebDAV server itself. Changes made directly on the server disk, or through another protocol, bypass them entirely.

WebDAV compared with other file access protocols

WebDAV competes with several older and newer ways of moving files across a network. Its main advantage is that it reuses HTTP infrastructure; its main weakness is performance with many small files, because each operation is a separate request with XML overhead.

ProtocolTransportStrengthLimitation
WebDAVHTTP or HTTPS on 80 or 443Passes firewalls, supports lockingChatty with many small files
FTPSeparate control and data channelsSimple bulk transfersNo encryption, hard with NAT
SFTPSSH on port 22Encrypted, robust file operationsNeeds SSH access, no web reuse
SMBTCP 445, mostly local networksRich file semantics and speedRarely exposed to the Internet
Object storage APIsHTTPS with custom REST callsMassive scaleNo standard folder or lock model
WebDAV versus related protocols

In practice, WebDAV remains the common denominator for cross-platform clients. Windows, macOS and Linux desktops can mount WebDAV shares natively or with standard tools, and many document management and cloud storage products expose a WebDAV endpoint alongside their own APIs.

Typical uses and configuration choices

WebDAV appears wherever files must be edited remotely by standard clients without special software. The decision table below shows when it fits and how to configure it.

ScenarioRecommendationReason
Self-hosted file sync and sharingWebDAV over HTTPSWorks with desktop and mobile clients
Calendar and contact syncCalDAV and CardDAVStandard support in most clients
Office document editing on a serverWebDAV with locking enabledPrevents conflicting saves
Very large bulk transfersSFTP or object storageLower per-file overhead
Public anonymous downloadsPlain HTTP GETNo authoring features needed
When to choose WebDAV

Servers such as Apache with mod_dav, nginx with its DAV modules and many application platforms provide WebDAV support. A sound configuration enforces HTTPS, requires authentication on every write method, limits request body size and disables Depth: infinity.

Security risks and common mistakes

Because WebDAV allows writing to a web server, misconfiguration can be severe. An unauthenticated PUT on a directory that executes scripts lets an attacker upload code and run it. The most frequent mistakes are listed below.

  • Enabling write methods without authentication, often left over from testing.
  • Using Basic authentication over plain HTTP, which exposes passwords on the network.
  • Allowing uploads into executable directories served by a script interpreter.
  • Ignoring large PROPFIND requests, which can be used for denial of service.
  • Assuming locks protect against non-WebDAV access, which they do not.

Clients also cause trouble: some desktop implementations send many redundant PROPFIND requests or handle redirects poorly, so performance problems are not always the server’s fault. Testing with a command-line client such as curl or cadaver helps isolate the cause.

The short version

WebDAV lets a website behave like a shared network drive. Instead of only showing pages, the server allows people to open, save, rename and organize files over the same connection a browser uses.

It also lets one person check out a document while editing, so a colleague does not overwrite the work. The main idea: WebDAV adds file editing to the web, which is why many sync apps and calendar tools quietly rely on it.

Where it makes a difference

An architecture office with 25 employees runs a self-hosted file server so that drawings stay on its own hardware. Staff work from the office, from home and from building sites, often on networks that block everything except HTTPS on port 443, which rules out SMB and makes SFTP awkward for non-technical users.

The office exposes the server through WebDAV over HTTPS with per-user accounts and exclusive locks enabled. Laptops map the share as a network drive, phones use a sync app, and the shared calendar runs on CalDAV from the same server. When two partners opened the same specification file on the same afternoon, the second one saw a lock notice instead of silently overwriting edits, and no work was lost during a year of daily remote use.