Search code examples
google-app-enginejakarta-eejsessioniddevserver

jsessionID gets appended to the url when running GAE devserver


For some reason string like: ;jsessionid=SESSION_HERE gets added to urls when I visit my app deployed to GAE devserver.

This messes things up since for some of the urls it cannot be parsed as as a GET parameter at all (sometimes it ends up with urls like: http://localhost:8080/someurl;jsessionid=0000).

My webapp configuraion is trivial and I use maven and appengine-maven-plugin to run devserver like this:

mvn appengine:devserver

What is the reason of this and how this can be removed?


Solution

  • Add:

    <context-param>
        <param-name>org.mortbay.jetty.servlet.SessionURL</param-name>
        <param-value>none</param-value>
    </context-param>
    

    ... to your web.xml. Read more on this in jetty session documentation.

    Note: GAE is running on Jetty 6.1. In anyone experiences the same problem with a newer Jetty version, the configuration parameter is named differently, see Jetty 9 session management:

    • org.eclipse.jetty.servlet.SessionIdPathParameterName

    • jsessionid

    • Session URL parameter name. Defaults to jsessionid, but can be set for a particular webapp with this context param. Set to "none" to disable URL rewriting.