This is my setup scenario:
Scenario for the standalone war:
Scenarios for the EAR archives:
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:
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.
Update:
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 /
Filed an issue at jboss jira and the issue is fixed in upcoming release.
A work-around currently is to have the following in your jboss-web.xml:
<?xml version="1.0"?>
<jboss-web>
<session-config>
<cookie-config>
<path>/</path>
</cookie-config>
</session-config>
</jboss-web>
<xml>
To complete the answer from @maress,
If your virtual hosts has a specific domain, you need to set in the domain of your virtual-host. (I need this when I test my web app in localhost with a fake domain name configured in /etc/hosts)
Something like that :
<?xml version="1.0"?>
<jboss-web>
<session-config>
<cookie-config>
<domain>special.mydomain.com</domain>
<path>/</path>
</cookie-config>
</session-config>
</jboss-web>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.