This project is archived and is in readonly mode.

#5633 ✓resolved
Alex

rails 2.3.8 and InvalidAuthenticityToken

Reported by Alex | September 15th, 2010 @ 12:17 PM | in 2.3.10

On the old project migrate to rails 2.3.8.
All good, but we have sometime such error from forms:

ActionController::InvalidAuthenticityToken: ActionController::InvalidAuthenticityToken

Backtrace:

[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/request_forgery_protection.rb:79:in verify_authenticity_token'


[GEM_ROOT]/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:178:in send'
[GEM_ROOT]/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:178:in evaluate_method'
[GEM_ROOT]/gems/activesupport-2.3.8/lib/active_support/callbacks.rb:166:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/filters.rb:225:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/filters.rb:629:in run_before_filters'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/filters.rb:615:in call_filters'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/filters.rb:610:in perform_action_without_benchmark'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue'
[GEM_ROOT]/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in ms'
/opt/ruby-ee-1.8.7-2010.01/lib/ruby/1.8/benchmark.rb:308:in realtime'
[GEM_ROOT]/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in ms'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in perform_action_without_rescue'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/rescue.rb:160:in perform_action_without_flash'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/flash.rb:151:in perform_action_without_newrelic_trace'
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/control/../agent/instrumentation/controller_instrumentation.rb:254:in perform_action'
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/agent/method_tracer.rb:141:in trace_execution_scoped'
[GEM_ROOT]/gems/newrelic_rpm-2.13.1/lib/new_relic/control/../agent/instrumentation/controller_instrumentation.rb:247:in perform_action'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in send'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in process_without_filters'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/filters.rb:606:in process'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/base.rb:391:in process'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/base.rb:386:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:438:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:87:in dispatch'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:121:in _call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:130
[GEM_ROOT]/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in call'
[GEM_ROOT]/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in call'
[GEM_ROOT]/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in cache'
[GEM_ROOT]/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:9:in cache'
[GEM_ROOT]/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:28:in call'
[GEM_ROOT]/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in call'
app/middleware/domain_middleware.rb:70:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in call'
[GEM_ROOT]/gems/rack-1.1.0/lib/rack/head.rb:9:in call'
[GEM_ROOT]/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/params_parser.rb:15:in call'
app/middleware/no_failsafe_api_middleware.rb:7:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/session/abstract_store.rb:128:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in call'
[GEM_ROOT]/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:106:in call'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/rack/request_handler.rb:92:in process_request'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_request_handler.rb:207:in main_loop'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/railz/application_spawner.rb:418:in start_request_handler'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/railz/application_spawner.rb:358:in handle_spawn_application'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/utils.rb:184:in safe_fork'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/railz/application_spawner.rb:354:in handle_spawn_application'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server.rb:352:in __send__'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server.rb:352:in main_loop'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server.rb:196:in start_synchronously'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server.rb:163:in start'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/railz/application_spawner.rb:213:in start'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/spawn_manager.rb:262:in spawn_rails_application'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server_collection.rb:126:in lookup_or_add'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/spawn_manager.rb:256:in spawn_rails_application'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server_collection.rb:80:in synchronize'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server_collection.rb:79:in synchronize'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/spawn_manager.rb:255:in spawn_rails_application'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/spawn_manager.rb:154:in spawn_application'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/spawn_manager.rb:287:in handle_spawn_application'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server.rb:352:in __send__'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server.rb:352:in main_loop'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/lib/phusion_passenger/abstract_server.rb:196:in start_synchronously'
/opt/ruby-ee/lib/ruby/gems/1.8/gems/passenger-2.2.10/bin/passenger-spawn-server:61

Parameters

{"action"=>"create",
 "authenticity_token"=>"KInlnQh1Mlyi8ALaWznQ068Vv0Y9lnmxjff3pSm48fs=",
 "controller"=>"some_controller", ...}
Session Data
{"csrf_token"=>"mwuQ5IeWsDZ9/J17GzufWFD4U9O7ry/BRfsLO4aJ1T4=", ... }

We dont wait so long (less 1 minute), but csrf_token != authenticity_token. How can I fix this? Maybe I need update Passenger to 2.2.15?

Problem solve by downgrading to 2.3.5 from 2.3.8, but I dont want do this.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages