tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: AW: mod_jk and session stickyness of images requests
Date Fri, 11 Dec 2009 16:30:12 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Timo,

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.

[snip]

> 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}"
src="org.apache.cocoon.transformation.EncodeURLTransformer">
> 	<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:

|img/@src

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAksic5QACgkQ9CaO5/Lv0PCHHQCgvapI5+h+N+ka/5ryHLcufXIN
+yMAn3yq5Nr3/CWLGP0D7f0fTCri+a93
=kiON
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message