Java (Tomcat): how to configure a cookieless subdomain to serve static content

Posted by Webinator on Stack Overflow See other posts from Stack Overflow or by Webinator
Published on 2010-05-21T17:12:00Z Indexed on 2010/05/21 17:40 UTC
Read the original article Hit count: 498

Filed under:
|
|

One of the tip given by both Google and Yahoo! to speed up webpages loading is to configure a cookieless subdomain to server static content.

How do you configure a "cookieless subdomain" using Tomcat in standalone mode (this question is not about how to use Apache to serve static content in a cookieless-way, but about how to do it in Tomcat-standalone mode)?

Note that I don't care about filters supporting If-Modified-Since nor care about filters supporting gzipping: the static content I'm serving is forever cacheable (or its name will change) and it is already compressed data (so gzip would only slow down the transfer).

Do I need two different Tomcat webapps? (one "cookiefull" and one "cookieless")

Do I need two different servlets? (as of now I've got only one dispatcher/controller servlet).

Why would a "regular" link to, say, a static image be called in a cookiefull way when it would be on the same domain as the main webapp and then be called in a "cookie-less" way when it is on a subdomain?

I don't understand exactly what is going on: is it the browser that decides to append or not cookies to the query? If so, why would it not append the cookies to a static query on a "cookieless" subdomain.

Any example as to what is going on behind the scene is most welcome :)

© Stack Overflow or respective owner

Related posts about java

Related posts about tomcat