I checked the HTTP headers with a Firefox addon called ‘Live HTTP Headers’ and also tried on the command line with curl, after copying my cookies from the ‘Live HTTP Headers’ output.
The response after enabling the code I posted earlier:
~]$ curl -I -L \
-H "Accept-Encoding: gzip,deflate" \
-H "Cookie: wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_ddabb3a971a9.....blahblah" \
https://wordpress.example.net/2013/11/25/full-post-example/
HTTP/1.1 200 OK
Date: Wed, 07 Jan 2015 23:08:05 GMT
Server: Apache
X-Powered-By: PHP/5.4.30
X-Pingback: https://wordpress.example.net/xmlrpc.php
Pragma: no-cache
X-UA-Compatible: IE=edge,chrome=1
Cleartype: on
Link: <https://wordpress.example.net/?p=1877>; rel=shortlink
ETag: "91c6daffe60356f55e9b91e864597bf5aa776ee2"
Last-Modified: Wed, 07 Jan 2015 03:52:58 GMT
Expires: Wed, 07 Jan 2015 23:08:05 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Vary: Accept-Encoding
Content-Encoding: gzip
Connection: close
Content-Type: text/html; charset=UTF-8
The response without the code.
~]$ curl -I -L \
-H "Accept-Encoding: gzip,deflate" \
-H "Cookie: wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_ddabb3a971a9.....blahblah" \
https://wordpress.example.net/2013/11/25/full-post-example/
HTTP/1.1 200 OK
Date: Wed, 07 Jan 2015 23:08:25 GMT
Server: Apache
X-Powered-By: PHP/5.4.30
X-Pingback: https://wordpress.example.net/xmlrpc.php
Pragma: no-cache
X-UA-Compatible: IE=edge,chrome=1
Cleartype: on
Link: <https://wordpress.example.net/?p=1877>; rel=shortlink
ETag: "91c6daffe60356f55e9b91e864597bf5aa776ee2"
Last-Modified: Wed, 07 Jan 2015 03:52:58 GMT
Expires: Fri, 09 Jan 2015 23:08:25 GMT
Cache-Control: public, max-age=172800
Vary: Accept-Encoding
Content-Encoding: gzip
Connection: close
Content-Type: text/html; charset=UTF-8
I get consistent and expected results every time I check according to whether the code is enabled or not.
A problem I noticed is that WordPress always sends a Pragma: no-cache
header. I’ll need to investigate this further.
Looking forward to your feedback.
George