reverse_proxy,endpoint,uploaded_media: add immutable cache-control flag
This commit is contained in:
parent
222306ff27
commit
848b3f5d5b
4 changed files with 4 additions and 4 deletions
|
|
@ -12,7 +12,7 @@ defmodule Pleroma.ReverseProxy do
|
||||||
@keep_resp_headers @resp_cache_headers ++
|
@keep_resp_headers @resp_cache_headers ++
|
||||||
~w(content-length content-type content-disposition content-encoding) ++
|
~w(content-length content-type content-disposition content-encoding) ++
|
||||||
~w(content-range accept-ranges vary)
|
~w(content-range accept-ranges vary)
|
||||||
@default_cache_control_header "public, max-age=1209600"
|
@default_cache_control_header "public, max-age=1209600, immutable"
|
||||||
@valid_resp_codes [200, 206, 304]
|
@valid_resp_codes [200, 206, 304]
|
||||||
@max_read_duration :timer.seconds(30)
|
@max_read_duration :timer.seconds(30)
|
||||||
@max_body_length :infinity
|
@max_body_length :infinity
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ defmodule Pleroma.Web.Endpoint do
|
||||||
plug(Pleroma.Web.Plugs.HTTPSecurityPlug)
|
plug(Pleroma.Web.Plugs.HTTPSecurityPlug)
|
||||||
plug(Pleroma.Web.Plugs.UploadedMedia)
|
plug(Pleroma.Web.Plugs.UploadedMedia)
|
||||||
|
|
||||||
@static_cache_control "public, max-age=1209600"
|
@static_cache_control "public, max-age=1209600, immutable"
|
||||||
@static_cache_disabled "public, no-cache"
|
@static_cache_disabled "public, no-cache"
|
||||||
|
|
||||||
# InstanceStatic needs to be before Plug.Static to be able to override shipped-static files
|
# InstanceStatic needs to be before Plug.Static to be able to override shipped-static files
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ defmodule Pleroma.Web.Plugs.UploadedMedia do
|
||||||
# no slashes
|
# no slashes
|
||||||
@path "media"
|
@path "media"
|
||||||
|
|
||||||
@default_cache_control_header "public, max-age=1209600"
|
@default_cache_control_header "public, max-age=1209600, immutable"
|
||||||
|
|
||||||
def init(_opts) do
|
def init(_opts) do
|
||||||
static_plug_opts =
|
static_plug_opts =
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ defmodule Pleroma.ReverseProxyTest do
|
||||||
|> expect(:stream_body, fn _ -> :done end)
|
|> expect(:stream_body, fn _ -> :done end)
|
||||||
|
|
||||||
conn = ReverseProxy.call(conn, "/cache")
|
conn = ReverseProxy.call(conn, "/cache")
|
||||||
assert {"cache-control", "public, max-age=1209600"} in conn.resp_headers
|
assert {"cache-control", "public, max-age=1209600, immutable"} in conn.resp_headers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue