File tree 4 files changed +22
-0
lines changed
4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1+ * Disables the session in ` ActiveStorage::Blobs::ProxyController `
2+ and ` ActiveStorage::Representations::ProxyController `
3+ in order to allow caching by default in some CDNs as CloudFlare
4+
5+ Fixes #44136
6+
7+ * Bruno Prieto*
8+
19## Rails 6.1.7.6 (August 22, 2023) ##
210
311* No changes.
Original file line number Diff line number Diff line change 44class ActiveStorage ::Blobs ::ProxyController < ActiveStorage ::BaseController
55 include ActiveStorage ::SetBlob
66 include ActiveStorage ::SetHeaders
7+ include ActiveStorage ::DisableSession
78
89 def show
910 http_cache_forever public : true do
Original file line number Diff line number Diff line change 33# Proxy files through application. This avoids having a redirect and makes files easier to cache.
44class ActiveStorage ::Representations ::ProxyController < ActiveStorage ::Representations ::BaseController
55 include ActiveStorage ::SetHeaders
6+ include ActiveStorage ::DisableSession
67
78 def show
89 http_cache_forever public : true do
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ # This concern disables the session in order to allow caching by default in some CDNs as CloudFlare.
4+ module ActiveStorage ::DisableSession
5+ extend ActiveSupport ::Concern
6+
7+ included do
8+ before_action do
9+ request . session_options [ :skip ] = true
10+ end
11+ end
12+ end
You can’t perform that action at this time.
0 commit comments