(52) Empty reply from server

Valentin V. Bartenev vbart at nginx.com
Thu May 5 14:02:50 UTC 2016

On Thursday 05 May 2016 10:27:46 Pankaj Chaudhary wrote:
> Hi,
> thank you!
> My module is basically for resource protection.
> I have already running  my module on other servers also.
> My module follow below steps.
> -Generate cookie and write in response header
> -read from header when cookie is needed
> IIS have API setheader() to set header  and getheader() to get header.
> Apache have apr_table_get() to get value from header and apr_table_set() to
> set the value in header.
> Do we have similar APIs in nginx?
> How i can achieve same kind of behavior in nginx?

If you want to set a response header, then should look to the
source of ngx_http_headers_module, which is responsible for
adding headers to output.

For reading cookies you can look to the $http_cookie variable

Please, use "grep" for search and read the code.

You can implement your module a way easier if you just provide
a directive, that can use the variable to read some value, and
adds a variable to set the value.

Then it can be used like this:

   protection_value $cookie_key;

   add_header Set-Cookie "key=$protection_value";

You can also check the ngx_http_secure_link_module:

  wbr, Valentin V. Bartenev

More information about the nginx mailing list