There is no way to influence HTTP headers by mod_jk.

You can manipulate Headers via mod_headers, which is part of Apache httpd.

If I remember correctly, in case Tomcat already sends a header, mod_headers will not be able to remove or overwrite it, because mod_jk will set the header Tomcat sent unconditionally (that's a field of possible optimisation, not done yet).

Be careful to fully understand the Caching headers, e.g. by studying the HTTP 1.1 RFC. For instance Cache-Control: no-cache does not really mean "do not cache", but instead "if you cache, then revalidate every time you want to use the item". There are also negative implications between "no-cache" and externally rendered objects as ODF, when using MSIE and SSL.

A servlet filter, as suggested by Christopher Schultz, could handle more logic (like setting different headers, if your http status is an error status etc.) and is partially reusable for all your webapps, once it is written.

Regards,

Rainer



[EMAIL PROTECTED] wrote:
Thanks Christopher,

To whom it may concern,

[EMAIL PROTECTED] wrote:
I've apache 1.3.36 + tomcat 4 + mod_jk 3.3
Something is wrong with that mod_jk version, by the
way. The most recent
release of mod_jk is 1.2.23.


Well, the installation file that I found in the server
is named: mod_jk-3.3-ap20.so, that's why I assumed
that version.


I'm very new to web servers. I have a problem with
the
cache configuration of a tomcat web application.
Using
a http headers inspector, I can see that no cache
control is been sent.
Cache-control headers are usually not sent unless
they are necessary.
Are you sure they are necessary for your
environment?

I'd like to send "CacheControl: no-cache" in the
header of every page of my app. First of all, is
this
something that I should configure in apache, in
tomcat
or in mod_jk???
I'm sure there are other ways to do this, but in
Tomcat, you can do it
easily by writing a simple "Filter" and installing
it in your
application. Writing a filter is as simple as
writing a class that
implements javax.servlet.Filter (3 methods) and then
installing it by
adding this to your WEB-INF/web.xml file:

    <filter>
        <filter-name>encodingFilter</filter-name>
        <description>
            A filter to ensure that the request has
a valid
            character encoding. This fixes problems
when the request is
            being sent in (say) UTF-8 but the user
agent doesn't specify
            the encoding.
        </description>

<filter-class>org.childhealthcare.diagnosis.servlet.EncodingFilter</filter-class>
    </filter>

This stuff goes right at the top of the web.xml
file, just inside the
<web-app> element. Note that filters are applied in
the order they
appear in web.xml, so you might want to familiarize
yourself with any
existing filters before you install this one.

The method you'll want to look for when implementing
your filter is
HttpServletResponse.addHeader(). You will probably
want to add your
header /before/ you hand-off processing to the next
filter in the chain.
Please please /please/ read the documentation for
Filter.doFilter before
you get started. You can find this documentation
here

(http://tomcat.apache.org/tomcat-5.5-doc/servletapi/javax/servlet/Filter.html)
as well as other places, I'm sure.

Hope that helps,
-chris




This method looks really cool, any way, does somebody
knows another solution. I read about configuring
apache http.conf and/or installing the headers module.
However, I don't know if modifying apache
configuration will solve the problem, maybe it's
something that should be modified in mod_jk or tomcat.
Does somebody knows this???

Is that filter installation the only way in which this
could be achieved with tomcat??

Thank You.  =)


Llama gratis a cualquier PC del mundo. Con una excelente calidad de sonido. http://mx.messenger.yahoo.com/

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to