Issue:
After browsing as anonymous and then logging in, the cached pages would still be served (thus showing one as not logged in).
I've spent hours researching this, focusing mainly on boostrap.inc. The issue was with Apache and the mod_expires-module.
I realize this could be Apache version specific, so this problem does not necessarily affect everyone. I've read enough about this problem in Drupal Forum (the issue, no solution) to know I'm not the only one who has been experiencing this.
What I did:
in .htaccess:
# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
# Enable expirations.
ExpiresActive On
# Cache all files for 2 weeks after access (A).
ExpiresDefault A1209600
# Do not cache dynamically generated pages.
ExpiresByType text/html A1
</IfModule>
Directly after the line starting with "ExpiresByType" I added the following:
# Set up 2 Hour caching on commonly updated files
ExpiresDefault A7200
# Force no caching for dynamic files
ExpiresActive Off
/code>
First I change the default for some file types that I update regulary (css updates that my users did not see in two weeks was..ugh).
Next, I turn off setting the Expires-headers for php-files as this is done by Drupal.
Atle