Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airisx/nginx_cookie_flag_module
Module for Nginx which allows to set the flags "HttpOnly", "secure" and "SameSite" for cookies.
https://github.com/airisx/nginx_cookie_flag_module
c cookie cookies flag httponly nginx nginx-module samesite secure
Last synced: 23 days ago
JSON representation
Module for Nginx which allows to set the flags "HttpOnly", "secure" and "SameSite" for cookies.
- Host: GitHub
- URL: https://github.com/airisx/nginx_cookie_flag_module
- Owner: AirisX
- License: bsd-2-clause
- Created: 2017-03-17T10:12:09.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-08T16:56:23.000Z (over 4 years ago)
- Last Synced: 2024-10-15T19:21:07.828Z (23 days ago)
- Topics: c, cookie, cookies, flag, httponly, nginx, nginx-module, samesite, secure
- Language: C
- Homepage:
- Size: 6.84 KB
- Stars: 106
- Watchers: 8
- Forks: 67
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The Nginx module for adding cookie flag
==========[![License](http://img.shields.io/badge/license-BSD-brightgreen.svg)](https://github.com/Airis777/nginx_cookie_flag_module/blob/master/LICENSE)
The Nginx module for adding cookie flag
## Dependencies
* [nginx](http://nginx.org)## Compatibility
* 1.11.x (last tested: 1.11.2)Earlier versions is not tested.
## Installation
1. Clone the git repository.
```
git clone git://github.com:AirisX/nginx_cookie_flag_module.git
```2. Add the module to the build configuration by adding
`--add-module=/path/to/nginx_cookie_flag_module`
or
`--add-dynamic-module=/path/to/nginx_cookie_flag_module`3. Build the nginx binary.
4. Install the nginx binary.
## Synopsis
```Nginx
location / {
set_cookie_flag Secret HttpOnly secure SameSite;
set_cookie_flag * HttpOnly;
set_cookie_flag SessionID SameSite=Lax secure;
set_cookie_flag SiteToken SameSite=Strict;
}
```## Description
This module for Nginx allows to set the flags "**HttpOnly**", "**secure**" and "**SameSite**" for cookies in the "*Set-Cookie*" upstream response headers.
The register of letters for the flags doesn't matter as it will be converted to the correct value. The order of cookie declaration among multiple directives doesn't matter too.
It is possible to set a default value using symbol "*". In this case flags will be added to the all cookies if no other value for them is overriden.## Directives
### set_cookie_flag
-| -
--- | ---
**Syntax** | **set_cookie_flag** \ [HttpOnly] [secure] [SameSite\|SameSite=[Lax\|Strict]];
**Default** | -
**Context** | server, locationDescription: Add flag to desired cookie.
## Author
Anton Saraykin []