7 Replies Latest reply on Mar 28, 2018 6:09 AM by rhusar

    JBOSS EAP 7.0 not adding Instance ID to SessionId

    piyushsharma1405

      We are migrating from JBOSS 6.4 to JBOSS 7.0, In JBOSS 6.4, to add Instance ID in JSession ID we have done below configuration in standalone configuration xml:

       

      <subsystem default-virtual-server="default-host" native="false" xmlns="urn:jboss:domain:web:2.2" instance-id="instanceName">

      ............

      ............

      </subsystem>

       

      However, on making similar configuration in JBOSS 7.0, as below, the instanceName is not getting appended into JSession ID:

       

      <subsystem xmlns="urn:jboss:domain:undertow:3.1" instance-id="instanceName">

      ...............

      ...............

      </subsystem>

        • 1. Re: JBOSS EAP 7.0 not adding Instance ID to SessionId
          ctomc

          are you running HA config?

          is your application distributable?

           

          but in general node id is no longer appended to session id, but it only shows in cookie value.

          but when you print out the id of the session you get it without the node id

          • 2. Re: JBOSS EAP 7.0 not adding Instance ID to SessionId
            piyushsharma1405

            Hi Tomaz,

             

            We are not running HA config, we are running standalone.xml config, and also our application is not distributed application.

             

            After adding instance-id="instanceName" attribute in the urn:jboss:domain:undertow:3.1 subsystem tag of standalone.xml,

            i am checking the JSESSIONID cookie value in browser developer tool to verify if the instance name is getting appended in the JSESSIONID cookie value.

            But it is not getting appended.

            • 3. Re: JBOSS EAP 7.0 not adding Instance ID to SessionId
              pferraro

              The instance ID should always get appended to the JSESSIONID cookie, even for non-distributed web applications.

              Can you paste your entire undertow subsystem configuration?

              • 4. Re: JBOSS EAP 7.0 not adding Instance ID to SessionId
                jotajboss

                Hi everyone,

                 

                Same problem here, it seems the instance-id is added when using standalone-ha.xml and not with standalone.xml, at least in my case:

                 

                # Standalone (instance-id not appended)

                [mad@max bin]$ ./standalone.sh -Djboss.instance.id=node1 -Djboss.node.name=node1

                [mad@max bin]$ curl -I http://127.0.0.1:8080/cluster-test/

                HTTP/1.1 200 OK

                Connection: keep-alive

                X-Powered-By: Undertow/1

                X-Powered-By: JSP/2.3

                Set-Cookie: JSESSIONID=vEE6VucqPJBCbewsJceWKRjVAYvT1oxWy0ItAWwu; path=/cluster-test

                Server: JBoss-EAP/7

                Content-Type: text/html;charset=ISO-8859-1

                Content-Length: 100

                Date: Mon, 29 Jan 2018 18:06:22 GMT

                 

                # Standalone-HA (instance-id appended)

                [mad@max bin]$ ./standalone.sh -c standalone-ha.xml -Djboss.instance.id=node1 -Djboss.node.name=node1

                [mad@max bin]$ curl -I http://127.0.0.1:8080/cluster-test/

                HTTP/1.1 200 OK

                Connection: keep-alive

                X-Powered-By: Undertow/1

                X-Powered-By: JSP/2.3

                Set-Cookie: JSESSIONID=5y1NCo9CM963aO5-OurRJAx2LMFl8wIi0AV3PJzm.node1; path=/cluster-test

                Server: JBoss-EAP/7

                Content-Type: text/html;charset=ISO-8859-1

                Content-Length: 100

                Date: Mon, 29 Jan 2018 18:03:38 GMT

                 

                As we can see in standalone mode there is no .node1 appended in JSESSIONID.

                 

                Undertow configuration in both cases:

                 

                        <subsystem xmlns="urn:jboss:domain:undertow:3.1" instance-id="${jboss.instance.id}">                                                                                                                       

                            <buffer-cache name="default"/>

                            <server name="default-server">

                                <http-listener name="default" socket-binding="http" redirect-socket="https"/>

                                <host name="default-host" alias="localhost">

                                    <location name="/" handler="welcome-content"/>

                                    <filter-ref name="server-header"/>

                                    <filter-ref name="x-powered-by-header"/>

                                </host>

                            </server>

                            <servlet-container name="default">

                                <jsp-config/>

                                <websockets/>

                            </servlet-container>

                            <handlers>

                                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

                            </handlers>

                            <filters>

                                <response-header name="server-header" header-name="Server" header-value="JBoss-EAP/7"/>

                                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

                            </filters>

                        </subsystem>

                 

                This doesn't make sense to me. Sometimes all you have is an Apache/Nginx web server load balacing between two or more nodes, with no need for HA configuration. This creates a huge problem with sticky sessions, any suggestion?

                 

                In domain mode it happens the same: if you create a server-group from a default profile, no instance-id is added to the JSESSIONID.

                 

                Regards,

                • 5. Re: JBOSS EAP 7.0 not adding Instance ID to SessionId
                  rhusar

                  There is no need to change the instance-id="..." as it defaults to the node name. Though, this looks like a bug. Could you upgrade and retest against EAP 7.1?

                  • 6. Re: JBOSS EAP 7.0 not adding Instance ID to SessionId
                    rakesjaya

                    Hi,

                     

                    We migrated from 6.1.0 to 7.0.0.

                     

                    Our configuration :

                    Jboss EAP 7.0.0 GA

                    default standalone file.

                    The same configuration as Piyush mentioned above. We are also not able to see node id along with JSESSIONID in browser cookie.

                     

                    Could anyone please let us know if any workaround can be done without upgrading to EAP 7.1?

                    • 7. Re: JBOSS EAP 7.0 not adding Instance ID to SessionId
                      rhusar