LoginSignup
7
3

More than 1 year has passed since last update.

Nginxでモジュール追加せずPath=/でないcookieにsecure属性を付与

Last updated at Posted at 2022-05-19

問題

よく紹介されている

proxy_cookie_path / "/; secure";

のような記述でcookieをsecure化しようとしたらできなかったので調査

環境等

Nginx :1.20.0
OS : Ubuntu18.04

結論

本家のproxy_cookie_pathの解説によると

proxy_cookie_path / "/; secure";

は、Path=/の場合に有効な技の模様

proxy_cookie_path ~(.*) "$1; secure";

の記述により、設定Pathの値にかかわらずsecure化された。

そもそも
Re: CookieのPath属性は本当に安全性に寄与しないのか
Path=/にすれば済む話なのだろうけれども

7
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
3