Forum Moderators: phranque

Message Too Old, No Replies

prevent caching, mod_expire

         

seekstewart

4:32 pm on Apr 20, 2005 (gmt 0)

10+ Year Member



i have added following lines in httpd.conf
also i tried to add these in the file .htaccess in the directory /l/apache/cgi-bin/

<FilesMatch "^t\.cgi$">
ExpiresActive on
ExpiresDefault A1
Header unset Cache-Control
Header set Cache-Control: "no-store, no-cache, must-revalidate"
Header unset Expires
Header set Expires "Thu, 01 Dec 1994 16:00:00 GMT"
</FilesMatch>

then i did sudo /l/apache/bin/apachectl configtest then sudo /l/apache/bin/apachectl graceful

when i open the url [xyz.com...] (i m printing headers in t.cgi)
i get the following output:

200 OK Date: Wed, 20 Apr 2005 16:08:13 GMT
Server: Web Server/1.3.28 (Unix) mod_ssl/2.8.15 OpenSSL/0.9.7c mod_gzip/1.3.26.1a mod_security/1.6 mod_jk/1.2.5 ApacheJServ/1.1.2
Cache-Control:
Expires:
Last-Modified: Sat, 16 Apr 2005 08:09:03 GMT
Etag: "f05478-98-4260c81f"
Content-Length: 152
Content-Type: text/html

why the Expires and Cache fields is empty? it means it is still caching data

sitz

1:43 am on Apr 21, 2005 (gmt 0)

10+ Year Member



Two things, which may or may not have a bearing on this:

[ol]

  • You don't need to 'Header unset' prior to issuing a 'Header set'; according to #header]the documentation [httpd.apache.org], a 'set' will replace any existing header with that same name.

  • You may want to ask the server directly what headers are being returned, like so:

    $ telnet 192.168.1.1 80
    Trying 192.168.1.1...
    Connected to 192.168.1.1.
    Escape character is '^]'.
    HEAD /cgi-bin/t.cgi HTTP/1.0
    Host: www.example.com

    HTTP/1.1 200 OK
    Date: Thu, 21 Apr 2005 01:38:41 GMT
    Server: Apache
    Cache-Control: no-store, no-cache, must-revalidate
    Expires: Thu, 01 Dec 1994 16:00:00 GMT
    Connection: close
    Content-Type: text/html

    Connection closed by foreign host.

    This may or may not give you more accurate information regarding what headers the server is returning. I'd try setting a bogus header, such as:


    Header set "X-Foo" "Bar"

    If you see that in the output headers, you know your .htaccess file is being properly parsed; the next step is to figure out why your headers are being removed. Is it possible that another module is removing them? Are there any proxies between your browser and the server?

  •