Browse Source

Set better Cache-Control header for static content

Closes #1382
tags/v1.1.7^2
rinpatch 4 years ago
parent
commit
66563f93fd
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      lib/pleroma/web/endpoint.ex
  2. +1
    -1
      test/plugs/cache_control_test.exs

+ 1
- 1
lib/pleroma/web/endpoint.ex View File

@@ -12,7 +12,7 @@ defmodule Pleroma.Web.Endpoint do
plug(Pleroma.Plugs.HTTPSecurityPlug)
plug(Pleroma.Plugs.UploadedMedia)

@static_cache_control "public, no-cache"
@static_cache_control "public max-age=86400 must-revalidate"

# InstanceStatic needs to be before Plug.Static to be able to override shipped-static files
# If you're adding new paths to `only:` you'll need to configure them in InstanceStatic as well


+ 1
- 1
test/plugs/cache_control_test.exs View File

@@ -9,7 +9,7 @@ defmodule Pleroma.Web.CacheControlTest do
test "Verify Cache-Control header on static assets", %{conn: conn} do
conn = get(conn, "/index.html")

assert Conn.get_resp_header(conn, "cache-control") == ["public, no-cache"]
assert Conn.get_resp_header(conn, "cache-control") == ["public max-age=86400 must-revalidate"]
end

test "Verify Cache-Control header on the API", %{conn: conn} do


Loading…
Cancel
Save