From 14b0bf72f6bf529664b454a0324941bcc013d338 Mon Sep 17 00:00:00 2001 From: thenav56 Date: Mon, 1 Jun 2026 12:23:40 +0545 Subject: [PATCH] feat: add Content-Disposition with param treat_as_download --- caddy/Caddyfile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index 51a84ca..ffd61c9 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -12,6 +12,11 @@ max_size 10MB } + @download { + path /media/* + query treat_as_download=true + } + @isStatic { path /static/* /media/* } @@ -28,6 +33,11 @@ Access-Control-Request-Methods "GET" Access-Control-Allow-Headers Content-Type } + + # Allow website to have download feature for files which browser can open (eg: json) + header @download { + Content-Disposition "attachment; filename={http.request.uri.path.file}" + } }