I found the solution in this blog Ruby on Rails, Varnish and user dependent content and i think the solution according to the blog is :
A good approach to get a simple solution to this problem is to add the application cookie to the hash Varnish uses to look for cached content. This is done in the vcl_hash function of the config file:
sub vcl_hash {
if (req.http.Cookie ~ "your_application_cookie") {
hash_data(req.url);
hash_data(req.http.Cookie);
return (hash);
}
}