0 Replies Latest reply on Jun 26, 2014 2:59 AM by Ochieng Marembo

    Wildfly 8 Session Problems in multi-virtual-host configurations

    Ochieng Marembo Newbie

      I did ask this question on stackoverflow: http://stackoverflow.com/questions/24362732/wildfly-8-session-problems-in-multi-virtual-host-configurations


      This is my setup scenario:

      1. EAR application with 2 ejbs, 4 war applications
      2. One standalone war application, absolute with no dependency on the ear artifacts.

      Scenario for the standalone war:

      1. virtual-host: config-service, at context-root, alias config.mydomain.com
      2. Uses jsf templates, such that the user is always on the same page, no redirects. The pages are determined dynamically based on the user action and current state.
      3. Wildfly 8 correctly determines jsessionid without any problem.

      Scenarios for the EAR archives:

      1. war1 at virtual-host: war1-web, at contextroot /, alias www.mydomain.com
      2. war2 at virtual-host: war2-mobile at contextroot /mobile, alias www.mydomain.com
      3. war3 and war4 are at default-host, with contextroot as /war3 and war4 respectively.

      Problem:When i log into www.mydomain.com everything is fine, every flow and links works fine. Now i log out (destroy current session by invalidating it and so own), and then try to login again:What i see:

      1. On my main page, i have jsessionid at path /
      2. When i navigate to another page, say /account, i now have 2 jsessionids one at / and another at /account.
      3. Further navigate to /account/profile, and now i will have 3 jsessionids: /, /account, /account/profile

      If i logged in at say: /login, wildfly ignores jsessionid at /, and generates a new one at /login, which of course will not be available at /account, and since some of my pages can only be accessed when logged in, the state at /account says am not logged, and hence i am redirected back to /, which shows that i am logged in now.

      Reason why application at config.mydomain.com does not show this issue is because i am always on the same path, no links to redirect you anywhere else, and hence everything is cool with wildfly session management.

      The conetxtroots at /war3 and /war4 are webservices, so in essence, they work since currently they dont need any scenarios of session management.

      I need to work with java ee7 features, and hence i cannot get back to jboss 7.1 as it has issues with most of the features i am using, including some cdi producers etc.

      I am hoping this is a configuration issues, and would like to have ideas of what mistakes i am doing in my urn:jboss:domain:undertow:1.1 subsystem configuration problems.



      I have manipulated the wildfly configurations and now everything works fine if i start form my home page, with no path constraint.

      That is: if i start from www.mydomain.com/home.xhtml, i can navigate to every page, and the session created at / is reused accordingly on every relative path, no more multiple jsessionids.

      However, if i start from a clean slate (using incognito mode), and jump directly to lets say, www.mydomain.com/path/another-path/page.xhtml, i get a jsessionid at /path/another-path, and subsequent navigations to different paths results into a different jsessionid (which in this circumstances is expected).

      Why does wildfly generates jsessionid at these paths, rather than at /