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

  • SEARCH
  • Home
  • 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 6174515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:46:00+00:00 2026-05-23T23:46:00+00:00

I am configuring varnish for the first time, and I have come across an

  • 0

I am configuring varnish for the first time, and I have come across an issue which I haven’t been able to find a complete answer for so far.

My config in a nutshell:

server0 – varnish,
be1 – apache,
be2 – apache

varnish pulls from the 2 backends in a round robin.

I need to deal with sessions, so I have configured a simple php script which sets the current time in a session variable, then redirects to a 2nd page which displays that session variable and the ip of the backend that was used.

I have managed to get this half working. It is passing the session info from what i can see, but here is the problem – the info returned from the backend is specific to the backend it was generated on. So, the time returned will depend on whether be1 or be2 was called for the last cache.

Is there a way that I can get this working so that the session variable is the same regardless of the backend that processes it?

  • 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-23T23:46:01+00:00Added an answer on May 23, 2026 at 11:46 pm

    This is the general problem with sessions; a cookie (sent with every request) contains an identifier for the session. The real session data is stored on a server or in a database. There are several solutions for this, e.g.:

    1. Sticky sessions; set an additional cookie variable (e.g. be=1 or be=2) or make the session id recognizably belong to backend 1 or 2. Varnish can then decide to which backend server the request should go. If a backend goes down, your session is lost (no “session fail over”)
    2. Store the session data in a database, memcached, or some other datastore shared by all backends
    3. Don’t use sessions but serialize all your data in a cookie. As clients are untrustable (cookies can be changed by a client) make sure to verify if the data is untampered, e.g. sign your data

    Look for some library/reusable code you can apply for your code and good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When configuring uwsgi django application for first time i had weird error. NGIX (configured
I am configuring Oracle Database in fips compliant mode, but not able to find
I´m configuring Redmine for the first time. Everything works fine except for the incoming
When configuring nginx with a site that has ssl, the examples I find online
I'm working on configuring a RollingFileAppender in log4net programmatically. I have something like this
I am configuring the env on Vista. I have jdk-6u30 and eclipse-jee-indigo-SR1-win32 installed on
Configuring IIS 6.0 to run an MVC3 application I think I have a configuration
I'm configuring an installer for our product which, up until now, was distributed as
I need help with configuring Reporting Services. I have the ReportServer and Report Manager
I'm having difficulty configuring Zend_Form. I have a Zend_Form sub-class. The form has some

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.