Sha256: c56efeda0e4adcdd54668af4ec30add4cd6518e15f62a73e2c4763737ce51a79

Contents?: true

Size: 576 Bytes

Versions: 12

Compression:

Stored size: 576 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"

module Decidim
  # 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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.8 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.7 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.6 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.5 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.4 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.3 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.2 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.1 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.0 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.0.rc2 app/controllers/concerns/decidim/http_caching_disabler.rb
decidim-core-0.27.0.rc1 app/controllers/concerns/decidim/http_caching_disabler.rb