Skip to content
This repository was archived by the owner on Jul 25, 2025. It is now read-only.

Commit 285426f

Browse files
committed
Add public cache control to application responses
1 parent 499f1dd commit 285426f

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

app/controllers/application_controller.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
class ApplicationController < ActionController::Base
2+
before_action :set_public_cache
3+
24
include SentryContext
35
include Redirectable
46

@@ -13,4 +15,10 @@ class ApplicationController < ActionController::Base
1315
Sentry.capture_exception(e) if defined?(Sentry)
1416
raise e
1517
end
18+
19+
private
20+
21+
def set_public_cache
22+
response.headers["Cache-Control"] = "public, max-age=3600"
23+
end
1624
end

0 commit comments

Comments
 (0)