Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Disable caching

Posted on 1999-07-22
4
Medium Priority
?
249 Views
Last Modified: 2013-12-25
I am writing a web-based application and I want that certain pages generated by my Perl Script should not be cached at all.( for security reason)
How can I disable caching thru Perl Script??
0
Comment
Question by:amresh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 2

Expert Comment

by:jonalee
ID: 1835149
try to add expire in you script:
I assume you use CGI.pm

print $q->header(-expires=>'-1d',-pragma=>'no-cache');

0
 

Author Comment

by:amresh
ID: 1835150
I never used CGI.pm. I am very new to this field. Kindly elaborate or suggest some
other solution.

Thanx
0
 
LVL 7

Accepted Solution

by:
nettrom earned 200 total points
ID: 1835151
CGI.pm is a commonly used Perl module that takes care of most CGI-related tasks, making writing your CGI-scripts a lot easier.  it's quite large though, so when you only need small things done or have a heavy load you won't load all of it.

to make sure that the output of your CGI isn't cached you need to send several headers to the browser.  which headers to use is found in the RFCs for HTTP, RFCS 1945 and 2068 for HTTP/1.0 and HTTP/1.1 respectively.  for HTTP/1.0 you want to send out the "Expires" or the "Pragma" header.  for HTTP/1.1 the header is called "Cache-control".  in straight Perl the script would do something like:

print "Content-type: text/html\n"; # provided we're outputting HTML
print "Expires: Thu, 1 Jan 1970 00:00:00 GMT\n"; # expired on epoch
print "Pragma: no-cache\n"; # pragma as according to RFC 1945
print "Cache-control: no-cache\n"; # cache-control, RFC 2068 (HTTP/1.1)
print "\n"; # for last \n\n marking the end of the header
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6872616
GREETINGS!

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.

http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
http://www.experts-exchange.com/jsp/zonesAll.jsp
 
Thank you,
Moondancer
Moderator @ Experts Exchange
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The viewer will learn how to dynamically set the form action using jQuery.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question