> -----Original Message-----
> From: Ralph Einfeldt [mailto:[EMAIL PROTECTED]]
> Sent: marted� 11 dicembre 2001 07:54
> To: Tomcat Users List
> Subject: AW: Apache + mod_jk (ajp13) + Tomcat: no "Expires" header in
> the response
>
>
> Is mod_expire enabled on the linux box ?
Yes, it is. I also add to httpd.conf these two lines:
ExpiresActive On
ExpiresByType text/html "access"
Apache sets "Expires" header for HTML pages under DocumentRoot (i.e.
/var/www/html/ or C:/Program Files/Apache Group/Apache/htdocs).
> AFAIK apache won't set the expires header unless you use mod_expire.
You're right.
> To enable expiring you have to do it on your own:
> <%
> response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
> response.setHeader("Pragma","no-cache"); //HTTP 1.0
> response.setDateHeader("Expires", 0); //prevents caching at
> the proxy
> server
> %>
This only works for HTML code generated by the servlet, not for static HTML
pages that reside under $TOMCAT_HOME/webapps/test.
Anyway, in both cases, Apache returns always the same date! And it not the
creation/modification date/time of any file under
$TOMCAT_HOME/webapps/test... can it be Tomcat startup time?
Here it is an excerpt of the Ethereal output: compare the sequence of
headers obtained with Apache + Tomcat under Linux and under Windows.
I didn't install Red Hat and Apache (another guy did the job), I only
installed Tomcat, maybe some configuration parameter needs to be set... is
it possible?
[Linux]
[From the browser I request /test/servlet/DateServlet]
C->Slinux GET /test/servlet/DateServlet HTTP/1.1
Slinux->C HTTP/1.1 200 OK
Date: Tue, 11 Dec 2001 09:56:37 GMT
Server: Apache/1.3.20 (Unix) (Red-Hat/Linux) mod_jk/1.1.0
mod_ssl/2.8.4 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.0.6 mod_perl/1.24_01
Cache-Control: no-cache
Expires: Mon, 10 Dec 2001 16:41:53 GMT
[After 3 seconds the browser refreshs requesting /test/date.html]
C->Slinux GET /test/date.html HTTP/1.1
Slinux->C HTTP/1.1 200 OK
Date: Tue, 11 Dec 2001 09:56:40 GMT
Server: Apache/1.3.20 (Unix) (Red-Hat/Linux) mod_jk/1.1.0
mod_ssl/2.8.4 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.0.6 mod_perl/1.24_01
Last-Modified: Mon, 10 Dec 2001 16:41:53 GMT
[I click on the "Update" link]
C->Slinux GET /test/servlet/DateServlet HTTP/1.1
Slinux->C HTTP/1.1 200 OK
Date: Tue, 11 Dec 2001 09:56:41 GMT
Server: Apache/1.3.20 (Unix) (Red-Hat/Linux) mod_jk/1.1.0
mod_ssl/2.8.4 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.0.6 mod_perl/1.24_01
Cache-Control: no-cache
Expires: Mon, 10 Dec 2001 16:41:53 GMT
[After 3 seconds the browser refreshs requesting /test/date.html]
C->Slinux GET /test/date.html HTTP/1.1
Slinux->C HTTP/1.1 200 OK
Date: Tue, 11 Dec 2001 09:56:44 GMT
Server: Apache/1.3.20 (Unix) (Red-Hat/Linux) mod_jk/1.1.0
mod_ssl/2.8.4 OpenSSL/0.9.6b DAV/1.0.2 PHP/4.0.6 mod_perl/1.24_01
Last-Modified: Mon, 10 Dec 2001 16:41:53 GMT
[Windows]
[From the browser I request /test/servlet/DateServlet]
C->Swin GET /test/servlet/DateServlet HTTP/1.1
Swin->C HTTP/1.1 200 OK
Date: Mon, 10 Dec 2001 16:59:32 GMT
Server: Apache/1.3.20 (Win32) mod_jk/1.1.0
[After 3 seconds the browser refreshs requesting /test/date.html]
C->Swin GET /test/date.html HTTP/1.1
Swin->C HTTP/1.1 200 OK
Date: Mon, 10 Dec 2001 16:59:35 GMT
Server: Apache/1.3.20 (Win32) mod_jk/1.1.0
Last-Modified: Mon, 10 Dec 2001 16:59:32 GMT
[I click on the "Update" link]
C->Swin GET /test/servlet/DateServlet HTTP/1.1
Swin->C HTTP/1.1 200 OK
Date: Mon, 10 Dec 2001 16:59:37 GMT
Server: Apache/1.3.20 (Win32) mod_jk/1.1.0
[After 3 seconds the browser refreshs requesting /test/date.html]
C->Swin GET /test/date.html HTTP/1.1
Swin->C HTTP/1.1 200 OK
Date: Mon, 10 Dec 2001 16:59:40 GMT
Server: Apache/1.3.20 (Win32) mod_jk/1.1.0
Last-Modified: Mon, 10 Dec 2001 16:59:37 GMT
>
> > -----Urspr�ngliche Nachricht-----
> > Von: Michele Milani [mailto:[EMAIL PROTECTED]]
> > Gesendet: Montag, 10. Dezember 2001 18:23
> > An: '[EMAIL PROTECTED]'
> > Betreff: RE: Apache + mod_jk (ajp13) + Tomcat: no "Expires"
> header in
> > the response
> >
> >
> > This stuff is getting *really* funny! I run it under Windows
> > and it worked.
> > I compared HTTP headers, the problem is that:
> >
> > - Apache (under Windows or Linux) does not set "Expires"
> > header for HTML
> > pages restituted by Tomcat
> > - Apache _under Linux_ sets a wrong (i.e. old, not updated)
> > "Last-Modified"
> > header, so that the browser loads a local cached copy of the page
> >
> > The time set by Apache into the "Last-Modified" header is not
> > the time of
> > creation/modification of any other file of my webapps/test
> > directory, so I
> > really can't understand how Apache sets it.
> >
> > Any hint?
> >
> > Cheers,
> > Michele
> >
> > > -----Original Message-----
> > > From: Michele Milani
> > > Sent: luned� 10 dicembre 2001 12:14
> > > To: '[EMAIL PROTECTED]'
> > > Subject: Apache + mod_jk (ajp13) + Tomcat: no "Expires"
> > header in the
> > > response
> > >
> > >
> > > Dear guys,
> > >
> > > I searched the archive and the Usenet without success.
> > >
> > > I'm using a box with:
> > >
> > > - Linux Red Hat 7.2
> > > - Apache 1.3.20
> > > - mod_jk (ajp13)
> > > - Tomcat 3.3
> > >
> > > I developed a web application that let you browse through
> > > some static HTML pages and let you update the content of
> > > these HTML page, inserting some data in a form.
> > >
> > > The update of the static pages is done by a servlet that
> > > rewrite the HTML file. The problem is that I can't get the
> > > last updated HTML page in my browser.
> > >
> > > I thought it was a problem realted to caching, so I forced
> > > Apache to set the "Expires" header writing in the httpd.conf:
> > >
> > > #ExpiresActive On
> > > #ExpiresByType text/html "access"
> > >
> > > but this solution didn't help.
> > >
> > > I turned on a protocol analyzer (Etheral) to try and
> > > understand what the problem was and I realized that Apache
> > > does not set the "Expires" header when the HTML page comes
> > > from Tomcat.
> > >
> > > I think my application is not so strange: I want to save the
> > > new data inserted by the user so that the next time she
> > > requests the page she gets the last version of it.
> > >
> > > I wrote another very simple application to explain my problem
> > > better, simply copy the following files under
> > > $TOMCAT_HOME/webapps/ and compile the servlet:
> > >
> > > ===============
> > > test/index.html
> > > ===============
> > > <html>
> > > <head>
> > > </head>
> > > <body>
> > > <a href="servlet/DateServlet">Test</a><br>
> > > </body>
> > > </html>
> > >
> > > =====================================
> > > test/WEB-INF/classes/DateServlet.java
> > > =====================================
> > > import java.io.*;
> > > import java.util.*;
> > > import javax.servlet.*;
> > > import javax.servlet.http.*;
> > >
> > > public class DateServlet extends HttpServlet {
> > >
> > > public void doGet(HttpServletRequest request,
> > > HttpServletResponse response) throws IOException,
> ServletException {
> > > try {
> > > Date now = new Date();
> > >
> > > PrintWriter dateWriter = new
> > > PrintWriter(new FileWriter("../webapps/test/date.html"), true);
> > > dateWriter.println(now);
> > > dateWriter.println("<br>");
> > > dateWriter.println("<a
> > > href=\"servlet/DateServlet\">Update</a>");
> > > dateWriter.close();
> > >
> > > response.setContentType("text/html");
> > > PrintWriter out = response.getWriter();
> > > out.println(now);
> > > out.println("<meta http-equiv='refresh'
> > > content='3; url=\"/test/date.html\"'></meta>");
> > >
> > > } catch(Exception ex) {
> > > PrintWriter errorWriter = new
> > > PrintWriter(new FileWriter("../webapps/bib/error.txt"), true);
> > > ex.printStackTrace(errorWriter);
> > > errorWriter.close();
> > > }
> > > }
> > >
> > > }
> > >
> > > Did anyone else experiment such problems?
> > >
> > > Cheers,
> > > Michele
> > >
> >
> > --
> > To unsubscribe:
<mailto:[EMAIL PROTECTED]>
> For additional commands: <mailto:[EMAIL PROTECTED]>
> Troubles with the list: <mailto:[EMAIL PROTECTED]>
>
>
>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe: <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>