Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 241
  • Last Modified:

prevent caching

if i open the url on the same window it returns the cahched data.
if i open in new window it works fine...

how do i prevent CGI from caching.


Rahul
0
shahrahulb
Asked:
shahrahulb
1 Solution
 
shahrahulbAuthor Commented:
i alreaady tried

print "<html> <head>
<META Http-Equiv=\"Cache-Control\" Content=\"no-cache\">
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">
<META http-equiv=\"Expires\" CONTENT=\"0\">

</head></html>";

not working
0
 
shahrahulbAuthor Commented:
is it possible that server is caching this data?????
0
 
kanduraCommented:
Hi shahrahulb,
> is it possible that server is caching this data?????

not very likely, unless you have a proxy server in between.
try adding the headers to the actual http header too, instead of just the meta's.

also, check what your browser does: install Firefox and get yourself the livehttpheaders extension. it's a life saver.

HTH,
Kandura
0
 
TintinCommented:
CGI scripts aren't cached as they dynamically generate their output.  However, if your webserver runs in a cluster, you may run into problems that appear to look like caching issues.
0
 
ahoffmannCommented:
shahrahulb suggestion is half-way correct, except that it only affects the client, but not the servers in the response chain

You have to write propper HTTP headers to prevent caching. Unfortunatelly there're some different one, and more worse browsers doe interprete them in different ways. I'd use all following headers:

Cache-Control : no-cache;
Pragma : no-cache;
Expires : -1

for more details see:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32

>  is it possible that server is caching this data
a propper configured server should respect above HTTP headers, and for CGI it should always add automatically:

Cache-Control : no-cache;
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now