I have a rails app and an api working together. The application has two years now and have been developped with the options (in application_controller):
skip_before_filter :verify_authenticity_token, :if => Proc.new { |c| c.request.format == 'application/json' }
#protect_from_forgery with: :null_session
So there was no protection at all against CSRF.
I added <%= csrf_meta_tag %> on all my view layouts and and protect_from_forgery on my application_controller.
The problem is that when my main page is requested, some ajax are executed and they do not contain the CSRF header so I get logout immediately.
How can I introduce the CSRF protection in my app?