When I use http.request, and get data successfully. Whether I relaunch the program or restart Codea. Even turn my iPad to Flight mode. I can still request successfully. And the data won’t refresh when I change it in the server. How can I let it refresh every time when I try to get data from same URL?
@Syeswr that’s an interesting — it might be a caching issue. Is the data from a particular server somewhere? Or does it happen with any data?
I wonder if the server is configured to use etags or is serving the data with a particular cache policy.
We can probably expose the cache policy as an optional argument in the future so you can override whatever the server requests.
@Simeon It could be universal.
-- Downloading data function setup() -- Request some data http.request( 'http://twolivesleft.com/hello.txt', didGetData, didNotGetData ) end -- Our callback function function didGetData( data, status, headers ) print( status..' : '..data ) end -- Our failure function function didNotGetData( error ) print( "Failed to get data. Error:" ) print( error ) end
I try to run this example from Codea reference once , and than flightmode my iPad. It still can get successfully. Even after I reboot my device.
so you’ve got to have an ‘.htaccess’ filein your server directory with something like this in it:
# Do not remove this line, otherwise mod_rewrite rules will stop working RewriteBase / AddType text/cache-manifest manifest ExpiresActive On ExpiresDefault "access"
i dont remember exactly which line does the trick, maybe ExpiresActive…
@Jmv38 It works! That’s awesome! Thanks.