Skip to content

Commit

Permalink
Fix cached actions.
Browse files Browse the repository at this point in the history
Actions fail when cached using memcached because of forgery protection.

Disabling the forgery proection for index actions fixes issue.

Also moves cached pages to temp folder.

Also removes useless expire config for cached pages.
  • Loading branch information
dkinzer committed Mar 1, 2024
1 parent b0b685a commit a2aaddb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/controllers/catalog_controller.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class CatalogController < ApplicationController
caches_page :show, expires_in: 24.hours
caches_page :show
caches_action :index, expires_in: 12.hours, cache_path: Proc.new { |c| c.request.url }

include FacetParamsDedupe
Expand All @@ -13,6 +13,7 @@ class CatalogController < ApplicationController
include ServerErrors
include LCClassifications

skip_forgery_protection only: [:index]
before_action :authenticate_purchase_order!, only: [ :purchase_order, :purchase_order_action ]
before_action :set_thread_request
before_action only: :index do
Expand Down
2 changes: 2 additions & 0 deletions config/environments/production.rb
Expand Up @@ -136,4 +136,6 @@
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
Deprecation.default_deprecation_behavior = :silence
config.action_controller.page_cache_directory = Rails.root.join("tmp", "cached_pages")
end
end

0 comments on commit a2aaddb

Please sign in to comment.