-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Timo,

On 12/11/2009 10:27 AM, Kockert, Timo wrote:
> first time posting to this list, so please don't be too hard with me ;-)

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? :)

> 3 servers running Tomcat 5.5.x with AJP connector
> 2 servers running Apache webserver 2.2.x with mod_jk 1.2.28
> [using sticky sessions and non-distributed sessions]

[snip]

> The problem is that our webapp renders images on-the-fly for incoming
> requests to content pages. That means, that image requests need use the
> same session as the request to the content page. They have to hit the
> same appserver because the images are just not present on the other
> appservers.

Got it.

> We configured our webapp to use cookies or - if cookies are not
> available - do url rewriting. This seems to work fine for say 90% of our
> requests. But it seems like some devices just don't send the session ID
> cookie with image requests. They send the cookie with the request to the
> content page but not with the following image requests.
> 
> Could this be a configuration problem on our side? Or is this something
> some devices do wrong? If so, has anyone an idea how to circumvent this
> issue?

The most likely problem is that you are not properly encoding the URLs
that reference images. You see this problem a lot with page authors who
always have cookies enabled in their browsers, because it's easy to
forget. You have to encode your URLs properly if you want session
stickiness to work. Here's how:

<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.

There are various tag libraries that properly-format URLs in this way so
you don't have to remember to do it yourself. Also, if you are using
some other output technology (Velocity, Freemarker, etc.), similar tools
should be available for those.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAksiaFsACgkQ9CaO5/Lv0PA3KwCfYR4K8RM6BliRE+qlf0pKODRg
kRsAli85WP+O7TyVkq0/xhgkByf6Wjw=
=ad3A
-----END PGP SIGNATURE-----

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

Reply via email to