Welcome! Log In Create A New Profile

Advanced

Re: Storing URI in a cookie

September 03, 2011 10:44AM
Thanks guys for the suggestions.

@calin - I have tried doing that but it messes with the verification page
and am not sure how to implement it correctly.

@Magicbear - I have put that code in there before the rewrite but then after
the rewrite when I try to access that cookie it is not there. I should have
been a little more clear on what I have tried and my config. Here is the
flow of the rewirte.

location / {
error_page 503 = @recaptcha;
if ($verifyvariable)
{
return 503;
}
}

location @recaptcha {

add_header Set-Cookie "originrequest=$request_uri path=/
expires=2m";
secure_cookie $cookie_CAPTCHA_SESSION,$cookie_CAPTCHA_EXPIRES;
rewrite ^ /captcha.html redirect;
}

location = /captcha.html {
#this has a form that submits information and goes to
/verify
}

location = /verify {
eval_inherit_body on;
eval_override_content_type 'text/plain';

eval $verify_content {
proxy_method POST;
proxy_set_header Accept-Encoding "";
proxy_set_body ;
rewrite .* /recaptcha/api/verify break;
proxy_pass 'http://www.google.com';
}

if ($verify_content ~* ^true[\s\R]*(.*)) {
set $error_code $1;
rewrite .* /set_secure_cookie last;
}

}

location = /set_secure_cookie {
internal;
## SETTING
rewrite ^ /$cookie_ originrequest redirect;
}



On Sat, Sep 3, 2011 at 5:04 AM, Calin Don <calin.don@gmail.com> wrote:

> A better way to redirect users is to store the uri in the redirection url.
> Storing it in a cookie causes problems if user opens two different tabs with
> two different uris for example.
> On Sep 2, 2011 11:42 PM, "Rami Essaid" <rami.essaid@gmail.com> wrote:
> > I dont know why I am struggling with this so much but I need a bit of
> help.
> > I am trying to redirect users to a verification page and then back to
> their
> > original requested URI but because of the rewrite I lose both the $uri
> and
> > $request_uri variables. I figure the easiest way to solve this problem is
> > to store the original URI in a cookie and read it from that after the
> > verification page. I cant seem to store the cookie correctly and read it
> > back. Can anyone provide some direction? Also, is there any risk that by
> > doing this I disrupt other cookies being stored by my application?
> >
> > Thanks!
> >
> > Rami
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
>
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Storing URI in a cookie

ressaid September 02, 2011 04:44PM

Re: Storing URI in a cookie

magicbear September 03, 2011 04:49AM

Re: Storing URI in a cookie

Calin Don September 03, 2011 05:06AM

Re: Storing URI in a cookie

ressaid September 03, 2011 10:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 195
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