Is my PHP script cache (public) friendly?

I have finished a small PHP application that can serve many documents. These documents must be cached by clients and .

Since proxies can cache my results, I have to be especially careful because the documents I serve may have different MIME types (content negotiation based on $ _SERVER ['HTTP_ACCEPT']) and different languages ​​(in this order: value $ _POST / $ _ GET value / URL / session value PHP / $ _ COOKIE value / $ _ SERVER ['HTTP_ACCEPT_LANGUAGE'] / default value script).

To summarize briefly, a page can be served with many MIME types and using the same URL (the question has changed: see below).

To help proxy cache, I use the "Vary: Accept" header in combination with the ETag header. ETags is the MD5 of the current language and the last modified timestamp.

I always:

  • Send Expires Header
  • Submit Cache-Control Header
  • Submit Last-Modified Header
  • Submit Content-Type Header
  • Send the ETag header (based on the current language and timestamp of the latest modification)
  • Submit Content-Language
  • Send the heading "Vary: Accept" if the XHTML document

: , - ? /?

, HTTP- ( ):

"
Date             Wed, 30 Dec 2009 18:56:26 GMT
Server           Apache/2.0.63 (Win32) PHP/5.1.0
X-Powered-By     PHP/5.1.0
Set-Cookie       Tests=697daqbmple2e1daq2dg74ur96; path=/
Expires          Wed, 30 Dec 2009 21:56:26 GMT
Cache-Control    public, max-age=10800
Last-Modified    Mon, 28 Dec 2009 15:11:49 GMT
Etag             "44fa50be4638161a596e4b75d6ab7a94"
Vary             Accept
Content-Language en-us
Content-Length   3043
Keep-Alive       timeout=15, max=100
Connection       Keep-Alive
Content-Type     application/xhtml+xml; charset=UTF-8
"

EDIT: . , MIME , ( - . ), . , "private" ( )... ?

URL- ( URL- MIME ), "" ( + )?

+5
3

, - , (-) , URL ( ) . , , , , , -, / .

, , , , , ETags URL-, - .

+3

, : Vary , , ETag.

, , Accept, Cookie Accept-Language. cookie , , If-None-Match, , ( ) ETag .

+1

If the answer changes to both "Accept" and "Accept-Language", then both of them should be mentioned in the response header "Vary".

0
source

All Articles