1

I have varnished and Apache setup. My Drupal 6 websites doesn't have any issue. But in all of my Drupal 7 setup I have following issue:

Issue: Whenever I visit pages of my websites anonymously, so browser have some caches of website, and than tried to log in and visit the same pages, I get the pages as anonymous visitor, after I refresh the page by Ctrl+F5 (Ctrl+R) I see the page as authenticated visitor!

if I haven't check the pages previously as anonymous user, it will not behave that way.

I don't think the problem is with the varnish, because I have the same issue when I by pass the varnish using https, or following method:

if (req.http.host == "example.com") {
  //let the request hit the backend, without cache processing
  return (pass);
}

Also I tried disabling mod_expires, but it didn't solve the issue. I tried IE9 and Firefox browsers.

I also checked my http header using Firefox and I saw that it doesn't even reload the cached page, unless I refresh the page from top or Ctrl+F5 and than I will get following header:

  Cache-Control public, max-age=21600
  Connection    Keep-Alive
  Content-Encoding  gzip
  Content-Language  en
  Content-Length    6156
  Content-Type  text/html; charset=utf-8
  Date  Fri, 01 Mar 2013 23:11:20 GMT
  Etag  "1362179480-1"
  Expires   Sun, 19 Nov 1978 05:00:00 GMT
  Keep-Alive    timeout=5, max=98
  Last-Modified Fri, 01 Mar 2013 23:11:20 +0000
  Link  <https://www.example.com/node/6>; rel="shortlink",<https://www.example.com/career.html>; rel="canonical"
  Server    Apache/2.2.14 (Ubuntu)
  Vary  Accept-Encoding
  X-Drupal-Cache    MISS
  X-Generator   Drupal 7 (http://drupal.org)
  X-Powered-By  PHP/5.3.2-1ubuntu4.18

Request Headersview source

  Accept    text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Encoding   gzip, deflate
  Accept-Language   en-US,en;q=0.5
  Cache-Control max-age=0
  Connection    keep-alive
  Cookie    Drupal.toolbar.collapsed=1; Drupal.tableDrag.showWeight=0; __utma=232802252.1062378112.1355538979.1362165767.1362177779.48; __utmz=232802252.1360443161.37.6.utmcsr=mail.google.com|utmccn=(referral)|utmcmd=referral|utmcct=/mail/u/0/; __atuvc=3%7C5%2C7%7C6%2C2%7C7%2C43%7C8%2C68%7C9; SSESSa353b9097cd9d66db87be4c783d6cc3e=vPLzEpcgrz2iO09tStKf-962kz__q7Jkts3lASJ0JCo; SSESS77f0a3186f1d40a3c071415ed9cd209c=Bbt24kN6RuIdyhevnk_SnqXL4eDbjDWO804j-c3vcCY; has_js=1; __utmb=232802252.35.10.1362177779; __utmc=232802252
  DNT   1
  Host  www.example.com
  If-Modified-Since Fri, 01 Mar 2013 23:10:38 +0000
  If-None-Match "1362179438-1"
  Referer   https://www.example.com/solutions.html
  User-Agent    Mozilla/5.0 (Windows NT 6.0; WOW64; rv:19.0) Gecko/20100101 Firefox/19.0

I find out that the problem is with varnish installation, by removing following line from setting.php it has been solved ! Don't forget to restart varnish after making changes in Setting.php!

  $conf['omit_vary_cookie'] = True;
  • Are you using Secure Pages or Secure Login? I have experienced the problems you're describing due to configuration issues with those modules. – Johnathan Elmore Mar 1 '13 at 23:55
  • No, I don't use any of those modules, and I see the same issue in all of my drupal 7 websites. Did you solve the issue, if yes what was causing it? and How? – Narek Terhovanesian Mar 2 '13 at 0:05
  • This is likely a duplicate of drupal.stackexchange.com/questions/91353 – znerol Dec 15 '13 at 16:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.