diff --git a/chef/cookbooks/horizon/recipes/ha.rb b/chef/cookbooks/horizon/recipes/ha.rb index 2de52b7754..bd16278b6f 100644 --- a/chef/cookbooks/horizon/recipes/ha.rb +++ b/chef/cookbooks/horizon/recipes/ha.rb @@ -15,20 +15,32 @@ include_recipe "crowbar-pacemaker::haproxy" +stick_options = { + # we want stickiness for the session (sessionid), but also for the login form + # (csrftoken) + cookies: ["sessionid", "csrftoken"], + expire: "#{node[:horizon][:session_timeout]}m" +} + haproxy_loadbalancer "horizon" do address "0.0.0.0" port 80 use_ssl false servers CrowbarPacemakerHelper.haproxy_servers_for_service(node, "horizon", "horizon-server", "plain") + stick stick_options action :nothing end.run_action(:create) if node[:horizon][:apache][:ssl] + stick_options = { expire: "#{node[:horizon][:session_timeout]}m" } + haproxy_loadbalancer "horizon-ssl" do address "0.0.0.0" port 443 use_ssl true servers CrowbarPacemakerHelper.haproxy_servers_for_service(node, "horizon", "horizon-server", "ssl") + stick stick_options + balance "source" action :nothing end.run_action(:create) end