mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-12-23 08:36:29 +00:00
Set correct Cache-Control header for local media
This commit is contained in:
parent
c62195127d
commit
413177c8f0
1 changed files with 6 additions and 0 deletions
|
@ -14,6 +14,8 @@ defmodule Pleroma.Plugs.UploadedMedia do
|
|||
# no slashes
|
||||
@path "media"
|
||||
|
||||
@default_cache_control_header "public max-age=86400 must-revalidate"
|
||||
|
||||
def init(_opts) do
|
||||
static_plug_opts =
|
||||
[]
|
||||
|
@ -58,6 +60,10 @@ defmodule Pleroma.Plugs.UploadedMedia do
|
|||
Map.get(opts, :static_plug_opts)
|
||||
|> Map.put(:at, [@path])
|
||||
|> Map.put(:from, directory)
|
||||
|> Map.put(:cache_control_for_etags, @default_cache_control_header)
|
||||
|> Map.put(:headers, %{
|
||||
"cache-control" => @default_cache_control_header
|
||||
})
|
||||
|
||||
conn = Plug.Static.call(conn, static_opts)
|
||||
|
||||
|
|
Loading…
Reference in a new issue