0

PrettyFaces kills the session on every request that involves a redirect when the application is deployed on Wildfly 8.1.0.Final. The same app deploys and works properly on Wildfly 8.0.0.Final.

On 8.1.0 PrettyFaces appears to prevent the servlet stack from retreiving the session ID.

The log shows no exceptions in either case. The URL rewrites occur, but session information (including login information) is gone. This is my pretty-config.xml

<pretty-config xmlns="http://ocpsoft.org/schema/rewrite-config-prettyfaces"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://ocpsoft.org/schema/rewrite-config-prettyfaces
                  http://ocpsoft.org/xml/ns/prettyfaces/rewrite-config-prettyfaces.xsd">

<url-mapping id="user-settings">
    <pattern value="/protected/user/settings/"/>
    <view-id value="/protected/usersettings.xhtml"/>
</url-mapping>

<url-mapping id="thread-edit">
    <pattern value="/protected/threads/edit/#{stitchId}/" />
    <view-id value="/protected/threads/stitch.xhtml" />
    <action>#{stitchEditBean.editStitchFromId(stitchId)}</action>
</url-mapping>

<url-mapping id="threads-index">
    <pattern value="/protected/threads/" />
    <view-id value="/protected/threads/index.xhtml" />
</url-mapping>
</pretty-config>

The failure occurs for both PrettyFaces 2.0.12.Final and 3.0.0.Alpha2

user3402489
  • 371
  • 2
  • 7

2 Answers2

2

As Ken noted, the underlying problem is related to https://issues.jboss.org/browse/WFLY-3448

Adding an explicit cookie path to web.xml works around the issue and is safe.

<session-config>
    <session-timeout>30</session-timeout>
    <cookie-config>
        <!--
        A bug in wildfly 8.1.0.final requires this path to be set explicitly or occasionally the default is
        incorrect and the system will generate one cookie per directory incorrectly.
        -->
        <path>/</path>
    </cookie-config>
</session-config>

You may have to manually clear the bad cookies in EACH directory of your app, or flush all your session cookies. Otherwise the old session cookies might hang around causing the issue.

user3402489
  • 371
  • 2
  • 7
0

This is a bug in WildFly 8.1.0, addressed here: https://issues.jboss.org/browse/WFLY-3448

After you are on a version that has that bug fixed, you will need to use Rewrite 3.0.0.Alpha3 or newer to resolve additional issues for handling the root context path.

Ken
  • 23
  • 3
  • Correct. I figured that out a day or two ago and forgot to come back here and update it.The explicit solution/work-around is to add a cookie path in web.xml and not reply on the automitic default. – user3402489 Aug 27 '14 at 15:28