• Stars
    star
    207
  • Rank 189,769 (Top 4 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

WebDAV handler module for Caddy

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

More Repositories

1

PapaParse

Fast and powerful CSV (delimited text) parser that gracefully handles large files and malformed input
JavaScript
12,285
star
2

json-to-go

Translates JSON into a Go type in your browser instantly (original)
JavaScript
4,408
star
3

archiver

Easily create & extract archives, and compress & decompress files of various formats
Go
4,055
star
4

timeliner

All your digital life on a single timeline, stored locally
Go
3,436
star
5

curl-to-go

Convert curl commands to Go code in your browser
JavaScript
1,773
star
6

caddy-l4

Layer 4 (TCP/UDP) app for Caddy
Go
963
star
7

binding

Reflectionless data binding for Go's net/http (not actively maintained)
Go
795
star
8

photobak

Back up your content from Google Photos - DEPRECATED: use Timeliner
Go
307
star
9

caddy-dynamicdns

Caddy app that keeps your DNS records (A/AAAA) pointed at itself.
Go
231
star
10

acmez

Premier ACME client library for Go
Go
216
star
11

golang-graphics

Community-contributed Go graphics files
138
star
12

caddy-ratelimit

HTTP rate limiting module for Caddy 2
Go
131
star
13

conncept

Project Conncept: A layer 4 app for Caddy that multiplexes raw TCP/UDP streams
58
star
14

caddy-embed

Caddy plugin for embedding static files directly into the server binary
Go
38
star
15

meetupchat

Simple chat using TCP, as a quick workshop for beginner (Go) programmers
Go
20
star
16

caddy-events-exec

Run commands on Caddy events
Go
19
star
17

vidagent

Easily filter your video files for content (requires ffmpeg)
Go
15
star
18

caddy-grpc-web

Caddy module to Convert gRPC-Web requests to normal gRPC for servers
Go
14
star
19

diskspace

A little Go package for measuring disk space/usage
Go
13
star
20

phpile

A file-system-based trie data structure that's persistent, portable, and super-fast. Experimental. Not for production use.
PHP
12
star
21

chessml

PGN file parser and Chess engine for machine learning, CS 478 group project
Go
6
star
22

dhall-adapter

Configure Caddy with Dhall
Go
4
star
23

caddy-psl

A public suffix list module for Caddy
Go
3
star
24

mholt.github.io

3
star
25

ysaward

An entire website for managing high-turnover YSA wards, with multi-stake support
PHP
1
star
26

lzip-go

An unmaintained copy of sorairolake/lzip-go before it disappeared (v0.3.5)
Go
1
star
27

blogtest

Testing testing 123
Shell
1
star
28

caddy-sqlite-fs

Go
1
star
29

caddy-hitcounter

Add a classic retro hit counter to your modern Caddy site
Go
1
star