I read that some middle-man servers won't cache websites that have cookie set in the vary: header. For example, If my website issues a vary:accept-encoding,cookie as opposed to vary:accept-encoding then caching will unlikely happen. This URL has further documentation:https://groups.google.com/forum/#!topic/page-speed-service-discuss/82-_dQfTFhcI'm using a home-brew version of PHP sessions in an attempt to reduce Time to First Byte (TTFB). and currently the sessions are stored as tracking cookies which makes some pages on my site not work correctly if cookie was removed from the vary: header.Another way I could save user configuration instead of cookies would be to check the client's IP address and load data from a local file as if it was a cookie. But before I think of implementing this, would it be a good idea, and would middle-man (I think they're called intermediate) caches always provide the correct page?If I'm confusing, I'll explain by example.Say I have a website where a user can change the background color of the screen with a click of one of two buttons and when other pages on the site are navigated, the last background color used will be shown until the user changes the color again.I can easily do this by storing the user's preference as a cookie and issuing vary:cookie on all responses, and the correct color will always load, even through middle-man caches.Now the question is, could I store user's preference as a file on the server and attach the remote IP address to it and not use vary:cookie? or will the middle-man cache disrupt passing the correct IP address and/or provide incorrect data due to its own caches? The point is I want to somehow eliminate cookie from the vary: header while still allowing a user to browse a website with their preferences always saved.Anyone got any idea how I can accomplish this?** Just found out... **According to https://serverfault.com/questions/195654/how-to-cache-websites-using-varnish-php-and-cookies , Varnish cache will not cache any output that includes cookie in the vary header. I'm curious if its legal across all browsers and systems to use my own header as a cookie header and if it would solve problems.
Eliminating 'cookie' from 'vary:' without breaking website functionality
ip address;cache;http headers;cookie