Serving Raw Files over Caddy

Apr 13, 2022

Rewrite the Content-Type header to serve raw files, as raw file delivery behaves inconsistently across different browsers.

@pgp_file path_regexp ^.*/public_pgp$
header @pgp_file Content-Type "text/plain; charset=utf-8"

@raw_file path_regexp ./raw/*
header @raw_file Content-Type "text/plain; charset=utf-8"

@ico_file path_regexp ^.*ico$
header @ico_file Content-Type "image/x-icon"

@jpg_file path_regexp .*jpe?g$
header @jpg_file Content-Type "image/jpeg"

@png_file path_regexp ^.*png$
header @png_file Content-Type "image/png"

@webp_file path_regexp ^.*webp$
header @webp_file Content-Type "image/webp"