What to put in http header to avoid caching ?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
pkmittal
Posts: 111
Joined: Thu Feb 08, 2007 11:27 am
Contact:

What to put in http header to avoid caching ?

Post by pkmittal » Fri Apr 20, 2007 12:07 pm

Hello,

When I use put command for calling http request then sometime it does not seems to return the new results, ( It could be either the proxy server at client side is returning the results from the cache or the server at out side is caching those requests )

Any idea about the script that can set http header to "No Cache" so that It always get the new results from the server ?

Is there any way to set the global property so that I do not need to set http headers in all places whereever I am forming http requests ?

Please let me know if you have some insights.

Thanks
Best Regards
Pradeep

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Fri Apr 20, 2007 7:12 pm

Hi Pradeep,

To prevent client-side caching, the server would include

Cache-Control: no-cache

in the HTTP headers. Server-side caching really is a server-side matter and there is little or nothing you can to against it, unless you are the admin of the server.

Do you have any additional information regarding the problem?

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

pkmittal
Posts: 111
Joined: Thu Feb 08, 2007 11:27 am
Contact:

Proxy server on client side seems to cache the results

Post by pkmittal » Sat Apr 21, 2007 6:24 am

Hello Mark,

I am asking clients to download the software which looks like the link below.
http:///www.xyz.com/player.exe

After updating the player.exe on the server, When I ask client to click on the above type of link and ask them to run the software then it is not taking the new exe always.

So It seems that proxy server on client side is not getting the latest exe from our server. Perhaps the proxy on client side is caching the exe on their firewall. Is there any way to avoid such problems ?

Another problem is how to make sure that whenever rev client sends http request, then proxy on clients always get the response from the server for each query. One way to solve the proble is appending the random parameters in each url, but for this things, the code has to be modified in many places.
Is there a way so that one can set the global propery of html headers in rev script to avoid a caching problems?

The response results is plain text generaated by php. I am not generating html headers in the response. Can I still avoid caching problems?

Please let me know if it is not clear enough.

Thanks
Best Regards
Pradeep

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Location: London, UK
Contact:

Re: Proxy server on client side seems to cache the results

Post by Mark Smith » Thu May 03, 2007 12:42 am

Pradeep, I don't believe that there is a way to permanently set the httpHeaders as you'd like, but you could write a simple wrapper function:

Code: Select all

function getURL pURL
  set the httpHeaders to "Cache-control : no-cache"
  return URL pURL
end getURL
so instead of "put URL someUrl into someVariable",
you'd have "put getURL(someURL) into someVariable".


Secondly, though you can't do much with it, you could at least see what the server is doing by checking what is returned by libURLLastRHHeaders() after each call to the server.

Best,

Mark Smith

Post Reply

Return to “Talking LiveCode”