Varnish VCL problem - Rails application

James Pearson james at ifixit.com
Thu Jan 30 00:34:06 CET 2014


Excerpts from Seyhun Akyürek's message of 2014-01-29 00:08:13 -0800:
> Hi, I have some questions;
> 
> I installed and configured Varnish 3, on my Ubuntu 12.04 EC2 instance for
> Rails 3.2 application. Using Devise for authentication.
> 
> But the problem is;
> 
> If I try to login via login form, all redirects doesn't work anymore. I
> returns back to login after submitting. (sign_in path and 302 redirects) if
> pass.
> 
> Varnish configuration:
> 
> /etc/default/varnish[https://gist.github.com/seyhunak/8664423][1]
> /etc/varnish/default.vcl[https://gist.github.com/seyhunak/7943277][2]

I'm not quite sure what you're trying to acomplish with all the regexes on the
Cookie header, but you probably want to have a rule something like this:

      # Don't cache requests from users who actually have a session cookie
      if (req.http.Cookie ~ "session=") {
         return (pass);
      }
		
		# Since we'll be caching this request and Cookies aren't part of the
      # hash key, don't even bother passing the cookies on to the backend.
      unset req.http.Cookie;

 - P



More information about the varnish-misc mailing list