Hey,
I’ve got HAproxy set up for a WE app with the help of John Joyce instructions for load balancing.
HAproxy sets a cookie called “serverid” that contains the proxy node the user is connected to as shown in the image below.
I’m trying to get that value from the app by using:
s = Session.Cookies.Value("serverid")
This returns nothing at all. I guess it’s because the app itself did not set this cookie value?
Any ideas on how to retrieve the value from “serverid”?
Thank you.
Got it working by executing a javascript that sets the apps HashTag to the value of “serverid”.
In the Session.HashTagChanged event I treat it with care
If someone needs it.
App.HTMLHeader:
<script type="text/javascript">
// Original JavaScript code by Chirp Internet: www.chirp.com.au
// Please acknowledge use of this code by including this header.
function getCookie(name)
{
var re = new RegExp(name + "=([^;]+)");
var value = re.exec(document.cookie);
return (value != null) ? unescape(value[1]) : null;
}
</script>
Call the funktion with:
ExecuteJavaScript("window.location.replace('#'+getCookie(""serverid""));")
Then you can get the value of the cookie in Session.HashTagChanged event.