views:

29

answers:

2

I wrote one script which is running on the linux machine.It fetches data from one url and displays the content on a page. The problem I am facing is some time if I refresh the page 4-5 times it displays the old content and not the latest one. The problem could be because of caching proxy which is still caching old content.

Please tell me what to write in the script which automatically delete the caching proxy.

+1  A: 

You should try using the Cache-Control HTTP header in your request, to tell the proxy (if there is one) not to cache the result.

See RFC 2616 for an explanation.

Macmade
+1  A: 

Take a look here: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/com.ibm.websphere.express.doc/info/exp/ae/twbs_cookie.html and set the following HTTP headers:

  • Expires with the value a hard coded GMT date in the past
  • Last-Modified with the value the current date in GMT formatted "EEE, d MMM yyyy HH:mm:ss"
  • Cache-Control with the following value 'no-store, no-cache, must-revalidate'
  • Cache-Control with the following value 'post-check=0, pre-check=0'
  • Pragma with the following value 'no-cache'
bogdanvursu