Session issue in Wildfly 10.1.0

I have two web applications 1. test.war 2. birt.war

I set cookies in the HTTP response header for birt url

Cookie cookie = new Cookie(GlobalConstants.JSESSIONID, request.getSession(false).getId());
cookie.setPath("/birt");
response.addCookie(cookie);

Then I open the birt url with the corresponding url parameters in javascript like

window.open(url);

But in the next request from birt, I got a new JSESSIONID. This works in JBoss6 AS.

I can see cookies in the developer console

**Request 1**
http://192.168.10.7:8080/test

Cookies are 
Response Cookie :
JSESSIONID : 
value = 9G6bzvsF-ijbynGTmbWp7Ml4E5KFVHiEPlSflh16
Path = /birt

**Request 2**

http://192.168.10.7:8080/birt

Cookies are 
Response Cookie :
JSESSIONID : 
value = **xrLqLb5-8Vvqlkk2GKyapqwJZm5dJnyvFQOia9IM.node1** // new cookie
Path = /birt

Request Cookie :
JSESSIONID : 
value = 9G6bzvsF-ijbynGTmbWp7Ml4E5KFVHiEPlSflh16
Path = /birt

I also tried adding to both wars in jboss-all.xml, but even that doesn't work.

<shared-session-config xmlns="urn:jboss:shared-session-config:1.0">
        <session-config>
            <cookie-config>
                <path>/</path>
            </cookie-config>
        </session-config>
</shared-session-config>
+4
source share
2 answers

I believe your deployment model is different from the one that Undertow supports:

Undertow , . : , , .

, shared-session-config jboss-all.xml META-INF

, https://docs.jboss.org/author/display/WFLY10/Web+(Undertow)+Reference+Guide

+2

Wildfly 10.1, single-sign-on (domain.xml/standalone.xml). :

<subsystem xmlns="urn:jboss:domain:undertow:3.1">
    <buffer-cache name="default"/>
    <server name="default-server">
        <http-listener max-post-size="1073741824" name="default" socket-binding="http"/>

        <host alias="localhost" name="default-host">
            <single-sign-on path="/"/>
        </host>
    </server>
    .
    .
    .
</subsystem>

jboss-web.xml disable-cross-context false:

<jboss-web>
    <context-root>/test</context-root>
    <disable-cross-context>false</disable-cross-context>
    .
    .
    .
</jboss-web>

, .

+1

Source: https://habr.com/ru/post/1686480/


All Articles