We have a nginx-reverse-proxy/cache and multiple backend-servers.
My current problem with our setup is that if a user hits a cached site he / she does not get a session-cookie set, as the backend is not hit. This is clearly the expected behavior.
In our case, however, I want the reverse-proxy to send a session-cookie with the cached response even before any of the backend-servers are hit.
I know I can use
add_header Set-Cookie
for this but how can I
- make sure the cookie is only set once?
- generate a cookie in the form of a uuid which is not hardcoded?