Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails log message: cache: [POST /action] invalidate, pass

I'm running rails 3 with jruby and trinidad, and I keep seeing these log messages:

INFO http-bio-3001-exec-15 jruby.rack - cache: [POST /something] invalidate, pass

What exactly does this mean? Also, the code in the controller is also never run. Is this an issue with caching?

like image 391
Richard Avatar asked May 10 '12 16:05

Richard


2 Answers

Whenever Rails receives a POST request, it performs some security checks to make sure the request is "valid". The checks are performed by parsing CSRF authenticity tokens which MUST be submitted along with the form in a POST request.

If you're not able to edit the form that is making the request to your rails app, you can skip the check on controller-by-controller basis:

class Foo < ApplicationController
    skip_before_filter :verify_authenticity_token

or you can also choose to do so for a specific method in the controller:

class Foo < ApplicationController
    skip_before_filter :verify_authenticity_token, :only => [:create]

You can read about it here

like image 128
Zain Zafar Avatar answered Sep 21 '22 06:09

Zain Zafar


cache: [POST /something] invalidate, pass

This is saying a POST request was issued and the invalidate, pass means that a cache couldn't be used for this type of request. You'll get the invalidate, pass for any change request (POST, PUT, DELETE etc)

like image 40
jvans Avatar answered Sep 18 '22 06:09

jvans