Indeed, but that prevents all cookies from being set. What I am looking for is to have a cache hit, but have the set-cookie served from the origin server. In Apache httpd cache, this can be accomplished with CacheIgnoreHeaders Set-Cookie.
The back end server here is Apache and I have tried setting it to send back this header:
Cache-Control:no-cache="set-cookie"
There just does not seem to be a combination of options for nginx that allows this to work.
I've tried this in nginx both with scenarios:
nginx -> Apache httpd -> wordpress
nginx-> Apache httpd -> tomcat
In both cases, proxy_hide_header will prevent the cookies from ever being set.