<div dir="ltr">Hi,<div><br></div><div>Its means nginx do not have any API as other server having to set header and get header ? very strange ...</div><div><br><div>I need to write my own module to read and write cookies values?</div></div><div>My module is in written in C programming language.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 5, 2016 at 7:32 PM, Valentin V. Bartenev <span dir="ltr"><<a href="mailto:vbart@nginx.com" target="_blank">vbart@nginx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thursday 05 May 2016 10:27:46 Pankaj Chaudhary wrote:<br>
> Hi,<br>
><br>
> thank you!<br>
> My module is basically for resource protection.<br>
> I have already running my module on other servers also.<br>
> My module follow below steps.<br>
> -Generate cookie and write in response header<br>
> -read from header when cookie is needed<br>
><br>
> IIS have API setheader() to set header and getheader() to get header.<br>
> Apache have apr_table_get() to get value from header and apr_table_set() to<br>
> set the value in header.<br>
><br>
> Do we have similar APIs in nginx?<br>
><br>
> How i can achieve same kind of behavior in nginx?<br>
><br>
</span>[..]<br>
<br>
If you want to set a response header, then should look to the<br>
source of ngx_http_headers_module, which is responsible for<br>
adding headers to output.<br>
<br>
For reading cookies you can look to the $http_cookie variable<br>
implementation.<br>
<br>
Please, use "grep" for search and read the code.<br>
<br>
You can implement your module a way easier if you just provide<br>
a directive, that can use the variable to read some value, and<br>
adds a variable to set the value.<br>
<br>
Then it can be used like this:<br>
<br>
protection_value $cookie_key;<br>
<br>
add_header Set-Cookie "key=$protection_value";<br>
<br>
You can also check the ngx_http_secure_link_module:<br>
<a href="http://nginx.org/en/docs/http/ngx_http_secure_link_module.html" rel="noreferrer" target="_blank">http://nginx.org/en/docs/http/ngx_http_secure_link_module.html</a><br>
<div class="HOEnZb"><div class="h5"><br>
wbr, Valentin V. Bartenev<br>
<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</div></div></blockquote></div><br></div>