Skip to content

Commit 834ebbf

Browse files
committed
feat: add Content-Disposition with param treat_as_download
1 parent 17e1ac1 commit 834ebbf

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

caddy/Caddyfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
max_size 10MB
1313
}
1414

15+
@download {
16+
path /media/*
17+
query treat_as_download=true
18+
}
19+
1520
@isStatic {
1621
path /static/* /media/*
1722
}
@@ -28,6 +33,11 @@
2833
Access-Control-Request-Methods "GET"
2934
Access-Control-Allow-Headers Content-Type
3035
}
36+
37+
# Allow website to have download feature for files which browser can open (eg: json)
38+
header @download {
39+
Content-Disposition "attachment; filename={http.request.uri.path.file}"
40+
}
3141
}
3242

3343

0 commit comments

Comments
 (0)