Welcome! Log In Create A New Profile

Advanced

nginScript and accessing cookies

Posted by Unsay Mono via nginx 
Unsay Mono via nginx
nginScript and accessing cookies
April 10, 2017 12:50AM
Hey everyone
In this nginx news article the author states:
> With nginScript you can route traffic based on any data in the request, including cookies, headers, arguments, or any keywords in the request body.
So far I've been unable to find any documentation on how to read and write to cookies from nginScript.
Has anyone got an example they could share?
Kind regards
Andreas
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Jeff Dyke
Re: nginScript and accessing cookies
April 10, 2017 04:10AM
at first glance i thought this may be dead, but perhaps you'd should look
here: https://www.nginx.com/blog/introduction-nginscript/, which supports
both Plus and OSS versions. I've been working with the lua module via
nginx-extras on ubuntu, they suit my needs, but that page may help you.

Jeff

On Sun, Apr 9, 2017 at 6:42 PM, Unsay Mono via nginx <[email protected]>
wrote:

> Hey everyone
>
> In this
> https://www.nginx.com/blog/launching-nginscript-and-looking-ahead/nginx
> news article the author states:
>
> > With nginScript you can route traffic based on any data in the request,
> including *cookies*, headers, arguments, or any keywords in the request
> body.
>
> So far I've been unable to find any documentation on how to *read *and *write
> *to cookies from nginScript.
>
> Has anyone got an example they could share?
>
> Kind regards
>
> Andreas
>
> _______________________________________________
> 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
Unsay
Re: nginScript and accessing cookies
April 13, 2017 10:00PM
Okay, I've found the answer to my question.

nginScript supports access to all of NGINX's variables. This also provides
access to the cookie like so:

myfunction(req, res) {
var cookie = req.variables.http_cookie;
}

Kind regards

Andreas

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,273509,273626#msg-273626

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login