Skip to content
Snippets Groups Projects
Commit 413177c8 authored by feld's avatar feld
Browse files

Set correct Cache-Control header for local media

parent c6219512
No related branches found
No related tags found
No related merge requests found
......@@ -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 @@ defp get_media(conn, {:static_dir, directory}, _, opts) 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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment