Coder Social home page Coder Social logo

caddy-webdav's Introduction

WebDAV for Caddy

This package implements a simple WebDAV handler module for Caddy.

Requires Caddy 2+.

Syntax

webdav [<matcher>] {
	root <path>
	prefix <request-base-path>
}

Because this directive does not come standard with Caddy, you need to put the directive in order. The correct place is up to you, but usually putting it near the end works if no other terminal directives match the same requests. It's common to pair a webdav handler with a file_server, so ordering it just before is often a good choice:

{
	order webdav before file_server
}

Alternatively, you may use route to order it the way you want. For example:

localhost

root * /srv

route {
	rewrite /dav /dav/
	webdav /dav/* {
		prefix /dav
	}
	file_server
}

The prefix directive is optional but has to be used if a webdav share is used in combination with matchers or path manipulations. This is because webdav uses absolute paths in its response. There exist a similar issue when using reverse proxies, see The "subfolder problem", OR, "why can't I reverse proxy my app into a subfolder?".

webdav /some/path/match/* {
	root /path
	prefix /some/path/match
}

If you want to serve WebDAV and directory listing under same path (similar behaviour as in Apache and Nginx), you may use Request Matchers to filter out GET requests and pass those to file_server.

Example with authenticated WebDAV and directory listing under the same path:

@get method GET

route {
    basicauth {
        username hashed_password_base64
    }
    file_server @get browse
    webdav
}

Or, if you want to create a public listing, but keep WebDAV behind authentication:

@notget not method GET

route @notget {
    basicauth {
        username hashed_password_base64
    }
    webdav
}
file_server browse

Credit

Special thanks to @hacdias for making caddy-webdav for Caddy 1, from which this work is derived: https://github.com/hacdias/caddy-webdav

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.