How to Remove jsessionid from URL

3,544 views
Skip to first unread message

lfeng

unread,
Oct 1, 2008, 10:57:21 PM10/1/08
to UrlRewrite
When somebody who access my website first time, all of the url have a
jsessionid ,and if he/she refresh the page,there is no jsessionid in
the URL,who can tell me why? and how to How to Remove jsessionid from
URL?

Alexandre Gauthier

unread,
Oct 2, 2008, 10:30:06 AM10/2/08
to urlre...@googlegroups.com, UrlRewrite
Are you by any chance using Glassfish/Sun Java Application Server?

We have the same problem...

--
Alexandre Gauthier
Analyste réseau / Network Analyst
Services Informatiques

Le 08-10-01 à 22:57, lfeng <bon...@gmail.com> a écrit :

Tim Beadle

unread,
Oct 2, 2008, 10:37:37 AM10/2/08
to urlre...@googlegroups.com
On Thu, Oct 2, 2008 at 3:30 PM, Alexandre Gauthier <mr.d...@gmail.com> wrote:
> Are you by any chance using Glassfish/Sun Java Application Server?
>
> We have the same problem...

We have the same problem, and we're using Tomcat; we thought it might
be a Struts config issue.

I don't *think* it's solvable using UrlRewrite (we've tried), but
would love to know if it is.

Tim

Scott Rossillo

unread,
Oct 2, 2008, 12:27:11 PM10/2/08
to urlre...@googlegroups.com

This is standard J2EE behavior. When you start a HTTP session, the
session ID is appended to the URL and a cookie is set. If the browser
has cookies enabled, the JSESSIONID is not used on subsequent requests.

Here is a urlrewrite rule to get rid of it, substitute JSESSIONID for
the name of the parameter your app server uses to track sessions.

<outbound-rule encodefirst="true">
<name>Strip URL Session ID's</name>
<from>^(.*?)(?:\;JSESSIONID=[^\?#]*)?(\?[^#]*)?(#.*)?
$</from>
<to encode="false">$1$2$3</to>
</outbound-rule>

Just be aware that removing the session id will make sessions not work
for clients that do not support cookies.

~ Scott

java developer1

unread,
Mar 8, 2011, 11:31:01 AM3/8/11
to urlre...@googlegroups.com

Hi,

It happens because the web server doesn't know if cookies are enabled on the
browser.

Refer to website:
http://javatechworld.blogspot.com/2011/01/how-to-remove-jsessionid-from-url-java.html
for more information.

> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "UrlRewrite" group.
> To post to this group, send email to urlre...@googlegroups.com
> To unsubscribe from this group, send email to
> urlrewrite+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/urlrewrite?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
>

--
View this message in context: http://old.nabble.com/How-to-Remove-jsessionid--from-URL-tp19776117p31098775.html
Sent from the UrlRewrite mailing list archive at Nabble.com.

java developer1

unread,
Mar 8, 2011, 11:31:17 AM3/8/11
to urlre...@googlegroups.com

Hi,

It happens because the web server doesn't know if cookies are enabled on the
browser.

> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google Groups
> "UrlRewrite" group.
> To post to this group, send email to urlre...@googlegroups.com
> To unsubscribe from this group, send email to
> urlrewrite+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/urlrewrite?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
>
>

--
View this message in context: http://old.nabble.com/How-to-Remove-jsessionid--from-URL-tp19776117p31098776.html

Reply all
Reply to author
Forward
0 new messages