This content has been marked as final.
Show 2 replies
-
1. Re: Wildfly 9 - add trailing slash to JSESSIONID
emeuwese Jan 7, 2018 3:06 PM (in response to kgancarz)You can control the cookie settings by adding WEB-INF\jboss-web.xml to your web app with the session-config
<?xml version="1.0" encoding="UTF-8"?> <jboss-web xmlns="http://www.jboss.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_8_0.xsd" version="8.0"> <context-root>/myapp/</context-root> <virtual-host>default-host</virtual-host> <session-config> <cookie-config> <path>/myapp/</path> <name>JSESSIONID</name> <http-only>true</http-only> <secure>true</secure> </cookie-config> </session-config> </jboss-web>
Or with adding session-config to WEB-INF\web.xml
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> ... <session-config> <session-timeout>15</session-timeout> <cookie-config> <path>/myapp/</path> <name>JSESSIONID</name> <http-only>true</http-only> <secure>true</secure> </cookie-config> <tracking-mode>COOKIE</tracking-mode> </session-config> </web-app>
-
2. Re: Wildfly 9 - add trailing slash to JSESSIONID
kgancarz Jan 8, 2018 4:39 AM (in response to emeuwese)I made this workaround, but it has a consequence that application must be deployed under /myapp on my application serwer, otherwise session cookie will not work.
For example Tomcat adds the trailing slash to session cookie path, so I suspected that it's possible in Wildfly too. If not, I'll have to stick to configuration in web.xml.