-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Hi, I'm trying to use Caddy to cache .m3u8 files when reverse proxying to an upstream server. I’m using the cache directive and set up my Caddyfile as follows:
{
order cache before rewrite
order cache before reverse_proxy
cache {
allowed_http_verbs GET POST
ttl 60s
timeout {
backend 20s
cache 100ms
}
}
}
:9991 {
route /ch1/* {
@m3u8_files {
path_regexp m3u8 ^/.*\.m3u8(\?.*)?$
}
handle @m3u8_files {
header +X-Custom-Header "Some Value"
}
cache @m3u8_files {
ttl 60s
}
uri strip_prefix /ch1
rewrite * /ChannelOne{uri}
reverse_proxy https://upstream-host.me {
header_up Host {http.reverse_proxy.upstream.hostport}
}
}
}
What’s working:
- The
X-Custom-Headeris successfully added to the.m3u8responses. - The reverse proxy is functioning and serving content.
What’s not working:
- The caching doesn't seem to take effect at all. I expected
.m3u8files to be cached for 60 seconds, but every request still hits the upstream server.
Any help or guidance would be appreciated. Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels