Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6709147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:50:46+00:00 2026-05-26T07:50:46+00:00

I’ve been looking into Varnish recently and doing some heavy Google searching. We’ve recently

  • 0

I’ve been looking into Varnish recently and doing some heavy Google searching. We’ve recently set this up in anticipation for Christmas on our server that runs an ecommerce site. We’ll be having increased return visits over the next few weeks, so using Varnish seemed like a good idea.

I was wondering if someone could clarify something for me – when using Varnish, if a user arrives for the first time it detects a new cookie (as sessions are used for the shopping cart) and caches the pages they visit.

However, if we wanted to cache more than a customers repeat visits, I saw on a seperate stackoverflow thread that editing the .vcl with the following will help it cache pages even if session_start is used:

     sub vcl_recv {
     unset req.http.Cookie;
     return (lookup);
     }

     sub vcl_fetch {
     unset beresp.http.Set-Cookie;
     set beresp.ttl = 24h;
     return(deliver);
     }

My question is – I’m a little confused as to the specifics of -what- would be cached. Would this cache someone’s shopping cart as well, thus serving this to all visitors to that product page?

Apologies if I’m missing a basic point of Varnish here; worst case scenario it’ll help take the load off for return visits, but caching more of the site would be even better!

Thanks very much in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:50:46+00:00Added an answer on May 26, 2026 at 7:50 am

    Varnish will not (by default) cache pages with set Cookies. Cookies introduce state to HTTP and thus Varnish can’t know whether or not the page has changed.

    Your above code snippet though will not fix your issue. It will just remove Cookie headers altogether. (I.e. you PHP backend will not receive session cookies.)

    Depending on how exactly your site looks like, you would either want to:

    • Leave behavior as is: If you for example have some place on the page saying the username of the logged in user you don’t want that to be cached. Basically in this case Varnish will only cache contents for guest (i.e. users without sessions)
    • If you don’t have such a user-dependent box on every page you can cache everything apart from the user-dependent (e.g. shopping cart) pages.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.