423 Locked는 접근하려는 리소스가 잠겨 있어(WebDAV lock) 요청을 수행할 수 없다는 뜻입니다. WebDAV는 협업 편집 시 여러 사용자가 같은 파일을 동시에 덮어쓰지 못하도록 명시적 잠금(LOCK) 메커니즘을 제공합니다.
누군가 파일을 잠근 상태에서 다른 사용자가 유효한 lock token 없이 쓰기(PUT/DELETE/MOVE)를 시도하면 서버가 423을 반환합니다. 주로 문서 협업(Microsoft Office, Nextcloud, ownCloud 등) 환경에서 나타납니다.
PUT /docs/report.docx HTTP/1.1
Host: dav.example.com
Content-Type: application/octet-stream
<file body>HTTP/1.1 423 Locked
Content-Type: application/xml
<?xml version="1.0"?>
<D:error xmlns:D="DAV:"><D:lock-token-submitted/></D:error>app.put('/docs/:name', (req, res) => {
const lock = locks.get(req.params.name);
if (lock && lock.token !== req.headers['if']) {
return res.status(423).type('xml')
.send('<D:error xmlns:D="DAV:"><D:lock-token-submitted/></D:error>');
}
// write the file...
});# Supply the lock token in the If header to edit a locked WebDAV resource
curl -X PUT https://dav.example.com/docs/report.docx \
-H 'If: (<urn:uuid:lock-token-here>)' \
--data-binary @report.docx