« 06.20 モッコシッポヨ | ココ | 06.24 EclipseのADTプラグインが消えた日 »
2010年6月23日
Railsでトークンあるのに422
開発用のサーバーでテストしてるとAjaxで呼び出しているHTMLが普通にうまく表示されるのに、どうしてか公開用のサーバーに入れて動かすとActionController#InvalidAuthenticityTokenのエラーが出てくる。
Processing MController#get_selector (for xx.xx.xx.xx at 2010-06-22 23:21:11) [POST]
Session ID: a8d91237e02852b6e1127788c9862176
Parameters: {"class"=>"a", "authenticity_token"=>"1afe239914d989fd65f5bbfdc41f94ed63e3d0c1", "action"=>"get_selector", "controller"=>"m"}
ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
/usr/lib/ruby/gems/1.8/gems/actionpack-2.1.2/lib/action_controller/request_forgery_protection.rb:86:in `verify_authenticity_token'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:173:in `send'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/callbacks.rb:173:in `evaluate_method'
困った…。
protect_from_forgery :except => :get_selector
とすれば、問題はひとまず収まるんだが。今度はSubmitしたときに403 Forbidden。
なぜか全く理由の見当がつかなかったけど、Apacheのログを見てようやくmod_securityが原因だと分かる(Apacheからリバースプロキシで繋いでるのです)。mod_securityってこんなところにも影響を与えるのか。RoRと組み合わせるときには相性に注意せんとあかんな。
By ただ at 22:51 カテゴリー ; プログラミングとか
« 06.20 モッコシッポヨ |
06月の記事
| 06.24 EclipseのADTプラグインが消えた日 »
トラックバック
このエントリーのトラックバックURL:
http://pinmarch.sakura.ne.jp/mt/mt-tb.cgi/1606