Sha256: 440a4d2b379a4c22b91cbb3c2ed6f98ec85279f6f15d0a6b190fd3ea0518d011

Contents?: true

Size: 625 Bytes

Versions: 13

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  module Headers
    # This module will disable http caching from the controller in
    # order to prevent proxies from storing sensible information.
    module HttpCachingDisabler
      extend ActiveSupport::Concern

      included do
        before_action :disable_http_caching
      end

      def disable_http_caching
        response.headers["Pragma"] = "no-cache"
        response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
        response.cache_control.replace(no_cache: true, extras: ["no-store"])
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.28.4 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.29.0 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.28.3 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.29.0.rc4 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.29.0.rc3 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.29.0.rc2 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.29.0.rc1 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.28.2 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.28.1 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.28.0 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.28.0.rc5 app/controllers/concerns/decidim/headers/http_caching_disabler.rb
decidim-core-0.28.0.rc4 app/controllers/concerns/decidim/headers/http_caching_disabler.rb