tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: AW: mod_jk and session stickyness of images requests
Date Fri, 11 Dec 2009 16:30:12 GMT
Hash: SHA1


On 12/11/2009 11:09 AM, Kockert, Timo wrote:
>> Welcome to the list. Hey, you posted your relevant environment details,
>> a clear description of your problem, and admitted that the problem might
>> be your own code. What more could we ask for? :)
> Thank you for the warm welcome and the fast reply :-)

No problem. You are benefiting from our relative time zones: my day is
just getting started and thus I haven't yet had a bad day yet :)

>> <img src="<%= request.getContextPath() %><%=
>> response.encodeURL("/path/to/my/image.png") %>" />
>> This will add the ";jsessionid=..." parameter (along with the jvmroute)
>> to the image's URL, ensuring that it is sent to the right back-end server.


> We are using Cocoon and its EncodeUrlTransformer to do the session ID encoding:
> <map:transformer logger="sitemap.transformer.encodeURL" name="encodeURL" pool-max="${encodeurl-transformer.pool-max}"
> 	<include-name>.*/@href=|.*/@action=|frame/@src=|img/@src=|input/@src=</include-name>
> 	<exclude-name>nonexistinghtmlelement/@nonexistingattribute=</exclude-name>
> </map:transformer>

Hmm... I haven't used that transformer before. I'll have to take a look.
Something that seems obvious to me is that you probably want to add
something like this to the include-name:


This will (presumably) instruct the EncodeUrlTransformer to also
transform <img> src attributes, too.

> As I wrote before this seems to be working fine for most devices.
> They
> either use cookies for all requests or all urls are beeing rewritten to
> include the session ID.

The devices themselves don't do the URL rewriting: your server-side code
(or someone else's, in the case of Cocoon) does it for you.

> And this is part of our problem: we cannot recreate the issue
> locally
> to debug it. We just see some 404s in the mod_jk logs from time to time.

Try just disabling cookies on your web browser and then checking the
pages. You ought to be able to figure out which images are failing by
just looking at your web server logs, and then searching for those image
references in your webapp. Browse to those pages with cookies disabled
and you should see broken images (or maybe not).

You could also write a filter that sends an error when the URL doesn't
contain a jsessionid, just for this no-cookies test so you can reproduce
it and test it.

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message