nginScript and accessing cookies

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

nginScript and accessing cookies

nginx mailing list
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
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: nginScript and accessing cookies

Jeff Dyke
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 <[hidden email]> wrote:
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
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: nginScript and accessing cookies

S.A.N
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
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Loading...