RaitteFeath
New Member
I have finalized a small PHP application that can serve many documents. These documents must be cacheable by clients and proxies.Since proxies can cache my results I must be extra careful because the documents I serve can have different MIMEs types (content negotiation based on $_SERVER['HTTP_ACCEPT']) and different languages (based in this order: $_POST value / $_GET value / URL / PHP session value / $_COOKIE value / $_SERVER['HTTP_ACCEPT_LANGUAGE'] / default script value).To shortly sum up, a page can be served with many MIME type and many languages with the same URL (question changed: see edit below).To help cache on proxies I use the "Vary: Accept" header in combination with the ETag header. The ETags is a MD5 of the current language and the last modified timestamp.I always:
- Send an Expires header
- Send a Cache-Control header
- Send a Last-Modified header
- Send a Content-Type header
- Send an ETag header (based on current language and Last-Modified timestamp)
- Send a Content-Language
- Send a "Vary: Accept" header if the document is XHTML