Skip to content

Commit 0193e8b

Browse files
authored
Merge pull request #37 from profiq/feature/cache-control
Add cache-control for static files
2 parents 7b3b0f2 + f4d459f commit 0193e8b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/swapi_web/endpoint.ex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ defmodule SWAPIWeb.Endpoint do
1111
same_site: "Lax"
1212
]
1313

14+
@static_cache_control "public, max-age=86400, s-max-age=172800, stale-while-revalidate=2678400"
15+
1416
socket "/live", Phoenix.LiveView.Socket,
1517
websocket: [connect_info: [session: @session_options]],
1618
longpoll: true
@@ -23,7 +25,8 @@ defmodule SWAPIWeb.Endpoint do
2325
at: "/",
2426
from: :swapi,
2527
gzip: false,
26-
only: SWAPIWeb.static_paths()
28+
only: SWAPIWeb.static_paths(),
29+
cache_control_for_etags: @static_cache_control
2730

2831
# Code reloading can be explicitly enabled under the
2932
# :code_reloader configuration of your endpoint.

0 commit comments

Comments
 (0)