how to create session persistence or hash_ip within server context for an if statement

Reinis Rozitis r at roze.lv
Mon Jan 24 10:15:05 UTC 2022


> I want to be able to do an redirect, but only one time, the hit it should
not redirect.
> 
> If a client visits an web-store it will get redirected to the region
specific store, but if then then manually select an other store there it
should not redirect back again. I don't know if a nginx session cookie is
possible or an way to use the nginx upstream module?

If your website uses cookies (and sets some information you can identify a
region) one way would be to make a decision on that - nginx can access
cookies using $cookie_COOKIENAME variable(s) so you can add it as an if() or
map conditions to decide if a redirect is needed.

rr



More information about the nginx mailing list