Closed defanator closed 6 years ago
Hi @defanator,
Yes, the key target of this module is set cookie flags for the upstream responses. In real situations we often doesn't know what security settings provides backend software and even we can't affect on it. This module cover this cases.
As for the "local" add_header
directives, if we can set a cookie, what prevents us from setting the required flags? For example:
location / {
add_header Set-Cookie "mycookie=from_static; HttpOnly";
}
But in any case, your idea is clear to me and I'll consider the need for its implementation. Thank you!
@AirisX maybe this change would be enough for now:
diff --git a/README.md b/README.md
index 93c3f2a..5681786 100644
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ location / {
## Description
-This module for Nginx allows to set the flags "**HttpOnly**", "**secure**" and "**SameSite**" for cookies in the "*Set-Cookie*" response headers.
+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.
@defanator I think, yes.
Example configuration:
So obviously the module works fine with upstream responses, and doesn't work with "local"
add_header
directives (which is somewhat expected for experienced nginx users), but it would be good to either have this clarified in documentation, or improve the code, if this behavior is wrong by the author's vision.Thanks.