How nginx's "location if" works (Was Re: Setting cache parameter via if directives)

Justin Cormack justin at specialbusservice.com
Fri Feb 18 16:23:33 MSK 2011


You could do that, or you could just write the session handling code in
Lua and output the page with the login box conditionally, or the non
logged in version, you don't have to redirect. More options!

Justin

On Fri, 2011-02-18 at 13:29 +0100, Alexander Kunz wrote:
> Thanks so much for the detailed answer.
> 
> So i think i am on the right way using html + jquery. The HTML page 
> loads all my css + js + static data  and jquery loads the content with 
> ajax calls. The Browser builds the page. Nginx + Lua + Redis and the 
> whole application flys... Great :)
> 
> Time to think a bit different :) The "old" way still stuck in my head. I 
> see there is a function access_by_lua but i still like session. Could 
> this the way to handle access to all files in app? Decript session and 
> encrypt session for refreshing the session livetime? Or shoud i use 
> access_by_lua in each location?
> 
>      location /app {
> 
>          set_decode_base32 $session $cookie_SID;
>          set_decrypt_session $raw $session;
>          set_encrypt_session $session $raw;
>          set_encode_base32 $session;
>          add_header Set-Cookie "SID=$session; path=/";
> 
>          if ($raw = '') {
>              rewrite (.*) /relogin.htm?url=$1 redirect;
>          }
> 
>          try_files $uri $uri/;
>      }
> 
> 
> Have a nice day, agentzh.
> 
> Alexander
> 
> 
> On 18.02.2011 12:55, agentzh wrote:
> > On Fri, Feb 18, 2011 at 7:54 PM, agentzh<agentzh at gmail.com>  wrote:
> >>     local data = get_data_from_remote()
> >>     local html = generate_html_from_template("/path/to/my/template")
> > Sorry, the last line should have been
> >
> >     local html = generate_html_from_template(data, "/path/to/my/template")
> >
> > Cheers,
> > -agentzh
> 
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx





More information about the nginx mailing list