I almost have 3 raspis (Apache, Domain Controller, Host Controller)
now working and can see session replication happening. Had to use
mod_proxy because building mod_cluster is involving.
One (hopefully) last bit...
How/where do I set the sticky session ?
On Fri, May 30, 2014 at 11:27 AM, Jason Greene <jason.greene(a)redhat.com> wrote:
On May 30, 2014, at 12:54 PM, Arun Gupta <arun.gupta(a)gmail.com> wrote:
>> A couple other options that would be fun to play with:
>> 1. Using Undertow’s reverse proxy like this (assuming you named the nodes pi1,
pi2, and thus they have a pi1, pi2 jvmroute, which defaults to the host name if you didn’t
>> <reverse-proxy name="reverse-proxy"
>> <host name=“http://p1.example:8080" instance-id=“pi1”/>
>> <host name=“http://p2.example:8080" instance-id=“pi2"/>
> Where will I add this fragment ?
In your domain.xml define a new profile called proxy, which is derived from the
In your new profile under the undertow subsystem, in the handlers section, below the
welcome content file handler, add the above proxy config. You then need to change the
location name=“/“ to point to the “reverse-proxy” handler (instead of “welcome-content”)
You basically want 3 server instances, one proxy, web server 1, and web server 2, all
preferably on separate systems. The proxy would be assigned the proxy profile, the two
other servers would get ha profiles.
You could have your DC collocated on the proxy or on a separate box. You need to be sure
that your instance-id matches the jvm route on the web 1 and 2 boxes (defaults to
hostname) for sticky sessions to work properly. If you look at the cookie value you will
see the jvmroute as a suffix.
>> 2. You could also use undertow 1.1 standalone which has a mod_cluster impl
(coming to WildFly soon)
>> (requires alteration for your topology)
> OK, let me try the simpler route first.
> I'm having issues building mod_cluster on ARM and following up on that
> separately. Seems like I may have to use mod_proxy for now since this
> is baked into Apache2 for ARM.
>>> The session ids are indeed different. Just pushed out the latest blog
>>> in this series at:
>>> The session id are shown towards the end in screen snapshots, and are
>>> indeed different.
>> So the problem is you need to either have a shared cookie domain, or use an LB,
since the cookie domain has to match the URL for the browser to send the same cookie. You
can do this in either the global config (standalone.xml under servlet-container), or you
can add a setting to your web.xml like this:
> Can this element be added to domain.xml as well for the managed domain mode ?
Yes next to the “server” block inside the undertow subsystem you can add:
Although note that you ONLY have to do this if you are not using an LB.
>> Then you want to add host entries to hosts:
>> pi1.example 10.x.x.x
>> pi2.example 10.x.x.x
> These entries would be made in each individual /etc/hosts ?
You just need this on the machine with the client browser, so that when it sends HTTP
requests it does “Host: pi1.example” instead of "Host: 10.xxxxx”.
If you decide to go the LB route, and want to have name references then you could do them
everywhere to make it all easy.
>> After you do that you should be able to stick pi1.example and pi2.example in the
>> Jason T. Greene
>> WildFly Lead / JBoss EAP Platform Architect
>> JBoss, a division of Red Hat
Jason T. Greene
WildFly Lead / JBoss EAP Platform Architect
JBoss, a division of Red Hat