I have a web server running on a Mega w/Ethernet shield and I am having problems caching my pages.
The arduino is on a private network and provides feedback and configuration of a couple of machines. Because of this, I see no reason for the arduino to be repeatedly sending pages since they will never change. The data will change, but that is all handled using ajax calls, but the html, js, css and images will not change.
So I am trying to force the browser to cache everything. To do that I am using the following headers to send a page to the browser (this one is for the css file for example)....
HTTP/1.1 200 OK Cache-Control: public,max-age=120 Content-Type: text/css Connection: keep-alive
After sending the headers, I send the file which resides on the SD card.
As I understand it, by using that header, if I refresh the page within 120 seconds, the browser should be using the cached copy of the css file rather than requesting it, but that is not the case. Each refresh is including a request for the css which the arduino gladly servers up.
I realize that this may not be a arduino question per se` but I am hopping someone can tell me what am I doing wrong, and how can I cache my pages. Thanks for your time. kevin