changeset 2599:5c5a36560f97

Added the proxy_cookie_flags directive.
author Yaroslav Zhuravlev <yar@nginx.com>
date Tue, 29 Sep 2020 15:52:05 +0100
parents 361a28cca097
children 2fd28cd4f2f8
files xml/en/docs/http/ngx_http_proxy_module.xml xml/ru/docs/http/ngx_http_proxy_module.xml
diffstat 2 files changed, 117 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_proxy_module.xml
+++ b/xml/en/docs/http/ngx_http_proxy_module.xml
@@ -10,7 +10,7 @@
 <module name="Module ngx_http_proxy_module"
         link="/en/docs/http/ngx_http_proxy_module.html"
         lang="en"
-        rev="68">
+        rev="69">
 
 <section id="summary">
 
@@ -875,6 +875,63 @@ inherited from the previous configuratio
 </directive>
 
 
+<directive name="proxy_cookie_flags">
+<syntax>
+    <literal>off</literal> |
+    <value>cookie</value>
+    [<value>flag</value> ...]</syntax>
+<default>off</default>
+<context>http</context>
+<context>server</context>
+<context>location</context>
+<appeared-in>1.19.3</appeared-in>
+
+<para>
+Sets one or more flags for the cookie.
+The <value>cookie</value> can contain text, variables, and their combinations.
+The
+<literal>secure</literal>,
+<literal>httponly</literal>,
+<literal>samesite=strict</literal>,
+<literal>samesite=lax</literal>,
+<literal>samesite=none</literal>
+parameters add the corresponding flags.
+The
+<literal>nosecure</literal>,
+<literal>nohttponly</literal>,
+<literal>nosamesite</literal>
+parameters remove the corresponding flags.
+</para>
+
+<para>
+The cookie can also be specified using regular expressions.
+In this case, <value>cookie</value> should start from
+the “<literal>~</literal>” symbol.
+</para>
+
+<para>
+Several <literal>proxy_cookie_flags</literal> directives
+can be specified on the same configuration level:
+<example>
+proxy_cookie_flags one httponly;
+proxy_cookie_flags ~ nosecure samesite=strict;
+</example>
+In the example, the <literal>httponly</literal> flag
+is added to the cookie <literal>one</literal>,
+for all other cookies
+the <literal>samesite=strict</literal> flag is added and
+the <literal>secure</literal> flag is deleted.
+</para>
+
+<para>
+The <literal>off</literal> parameter cancels the effect
+of the <literal>proxy_cookie_flags</literal> directives
+inherited from the previous configuration level.
+</para>
+
+</directive>
+
+
 <directive name="proxy_cookie_path">
 <syntax><literal>off</literal></syntax>
 <syntax><value>path</value> <value>replacement</value></syntax>
--- a/xml/ru/docs/http/ngx_http_proxy_module.xml
+++ b/xml/ru/docs/http/ngx_http_proxy_module.xml
@@ -10,7 +10,7 @@
 <module name="Модуль ngx_http_proxy_module"
         link="/ru/docs/http/ngx_http_proxy_module.html"
         lang="ru"
-        rev="68">
+        rev="69">
 
 <section id="summary">
 
@@ -877,6 +877,64 @@ proxy_cookie_domain ~\.([a-z]+\.[a-z]+)$
 </directive>
 
 
+<directive name="proxy_cookie_flags">
+<syntax>
+    <literal>off</literal> |
+    <value>кука</value>
+    [<value>флаг</value> ...]</syntax>
+<default>off</default>
+<context>http</context>
+<context>server</context>
+<context>location</context>
+<appeared-in>1.19.3</appeared-in>
+
+<para>
+Задаёт один или несколько флагов для куки.
+В качестве <value>куки</value>
+можно использовать текст, переменные и их комбинации.
+Параметры
+<literal>secure</literal>,
+<literal>httponly</literal>,
+<literal>samesite=strict</literal>,
+<literal>samesite=lax</literal>,
+<literal>samesite=none</literal>
+добавляют соответствующие флаги.
+Параметры
+<literal>nosecure</literal>,
+<literal>nohttponly</literal>,
+<literal>nosamesite</literal>
+удаляют соответствующие флаги.
+</para>
+
+<para>
+Куки также можно задать при помощи регулярных выражений.
+При этом <value>кука</value> должна начинаться с символа
+“<literal>~</literal>”.
+</para>
+
+<para>
+На одном уровне конфигурации может быть указано
+несколько директив <literal>proxy_cookie_flags</literal>:
+<example>
+proxy_cookie_flags one httponly;
+proxy_cookie_flags ~ nosecure samesite=strict;
+</example>
+В данном примере флаг <literal>httponly</literal>
+добавляется к куке <literal>one</literal>,
+для остальных кук
+добавляется флаг <literal>samesite=strict</literal> и
+удаляется флаг <literal>secure</literal>.
+</para>
+
+<para>
+Параметр <literal>off</literal> отменяет действие всех директив
+<literal>proxy_cookie_flags</literal>
+на данном уровне.
+</para>
+
+</directive>
+
+
 <directive name="proxy_cookie_path">
 <syntax><literal>off</literal></syntax>
 <syntax><value>путь</value> <value>замена</value></syntax>