Welcome! Log In Create A New Profile

Advanced

Nginx logic (if cookie set, redirect here…) Is it possible?

Posted by tomdelonge 
Nginx logic (if cookie set, redirect here…) Is it possible?
May 28, 2010 02:06AM
So, I have a pretty basic need, but I can't figure out if it's even possible, much less how to do it.

I have a main page that anyone can see. Most of the rest of the application can be seen only if logged in (hence, a "set cookie"). So I was thinking, as long as they don't have a cookie set, they can just see a cached version of nginx. I can get it caching with this:
[code]
proxy_cache STATIC;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
[/code]
And it helps a ton. (instead of 15 requests per second it gets over 1000). Now I just need some sort of "server logic" to say only serve the cached page if they have no cookie, otherwise, load the dynamic page (which will automatically redirect them into the app).

Any ideas?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 141
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready