1
votes

My challenge is the following. I'd like to uphold the Post/Redirect/Get pattern for posted forms, but after the redirect I still want to show the state of the form in case of invalid fields. This information can be passed by storing it in session quite easily.

However these sites usually run on multiple webservers behind a load balancer, which are configured NOT to be sticky. There is also no shared session state on purpose.

To use local session state on the webservers would be preferrable for scalability, but to do that you need sticky sessions. Sticky sessions are however a hindrance to the people who manage the servers, because after removing some servers from the load balancer to do a release, they still have to wait some 10 to 15 minutes before all sessions have ended. Without stickiness it's almost instantaneously.

What would be really cool is if we could make the session sticky for just one single subsequent request after a POST or REDIRECT. Or even have total control over when to enable or disable stickiness from code.

Does anyone know if this behaviour is possible? By settings a certain cookie perhaps? Or some http header?

1
You've told us nothing about either the application software or LB hardware in use, and therefore nothing on which to base an answer.skaffman
Application software is a website based on ASP.NET MVC running on IIS6. I don't know yet which load-balancer is used, but will find out tomorrow. I already figured that - if it's possible at all - it will probably be dependant on the model of the load-balancer. But perhaps you already know of some load balancers that feature these kind of tricks, while others don't. Or even better, a generic way to do this.Jorrit Salverda
The load balancer is a Citrix Netscaler.Jorrit Salverda

1 Answers

0
votes

Few ideas:

  1. Central cache server

    • save it to a cache server (prefered redis) with expiration
    • redirect to the get action with a parameter in the url. Using this parameter restore the model.
  2. State in the url

    • if the model is small You can save it as parameters in the url.