It seems the instance-id in JSESSIONID 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.