diff --git a/lib/plug/static.ex b/lib/plug/static.ex index c5aad8b5..fd9804ba 100644 --- a/lib/plug/static.ex +++ b/lib/plug/static.ex @@ -163,7 +163,7 @@ defmodule Plug.Static do %{ encodings: encodings, only_rules: {Keyword.get(opts, :only, []), Keyword.get(opts, :only_matching, [])}, - qs_cache: Keyword.get(opts, :cache_control_for_vsn_requests, "public, max-age=31536000"), + qs_cache: Keyword.get(opts, :cache_control_for_vsn_requests, "public, max-age=31536000, immutable"), et_cache: Keyword.get(opts, :cache_control_for_etags, "public"), et_generation: Keyword.get(opts, :etag_generation, nil), headers: Keyword.get(opts, :headers, %{}), diff --git a/test/plug/static_test.exs b/test/plug/static_test.exs index d3f65b14..2a3ed8cb 100644 --- a/test/plug/static_test.exs +++ b/test/plug/static_test.exs @@ -148,7 +148,7 @@ defmodule Plug.StaticTest do assert conn.status == 200 assert conn.resp_body == "HELLO" assert get_resp_header(conn, "content-type") == ["text/plain"] - assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000"] + assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000, immutable"] assert get_resp_header(conn, "etag") == [] assert get_resp_header(conn, "x-custom") == ["x-value"] end @@ -503,7 +503,7 @@ defmodule Plug.StaticTest do assert get_resp_header(conn, "content-type") == ["text/plain"] assert get_resp_header(conn, "accept-ranges") == ["bytes"] assert get_resp_header(conn, "content-range") == ["bytes 0-1/5"] - assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000"] + assert get_resp_header(conn, "cache-control") == ["public, max-age=31536000, immutable"] assert get_resp_header(conn, "etag") == [] assert get_resp_header(conn, "x-custom") == ["x-value"] end